Compare projects
Project comparisons allow you to view any selection of projects side by side just like they're shown on regular categories or in search results. You can try out an example or start yourself by adding a library to the comparison via the input below. You can also easily share your current comparison with others by sending the URL of the current page.
0.0
== Synopsys
Class-level configuration DSL
== Installation
gem install config_accessor
== Examples
require 'config_accessor'
class Remote
configurable!
config_accessor :host, :default => "localhost"
config_accessor :port, :default => "80", :transform => :to_i
config_accessor :proxy_host, :proxy_port
end
class Local < Remote
config_accessor :l_port
end
Remote.host # => "localhost"
Remote.port # => 80
Remote.proxy_host # => nil
r = Remote.new
r.port = "81"
r.port # => 81
Remote.port # => 80
Remote.port = 82
# next expressions are equivalent
r.port # => 81
r.config[:port] # => 81
r.config["port"] # => 81
r.config.port # => 81
# It supports inheritance, subclasses cannot change superclasses configurations
Local.port # => 80
# You can do it with +configure+ method
Local.configure do
port 81
end
# or
Local.configure do |config|
config.port 81
end
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026