Class: Block::Common::Configuration
- Inherits:
-
Object
- Object
- Block::Common::Configuration
- Defined in:
- app/models/block/common/configuration.rb
Instance Attribute Summary collapse
-
#company_name ⇒ Object
Returns the value of attribute company_name.
-
#copyright_date ⇒ Object
Returns the value of attribute copyright_date.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #method_missing(method_sym, *arguments, &block) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
4 5 6 7 8 |
# File 'app/models/block/common/configuration.rb', line 4 def initialize @company_name = "Rails Blocks" @copyright_date = "2015-2016" @variables = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_sym, *arguments, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'app/models/block/common/configuration.rb', line 10 def method_missing(method_sym, *arguments, &block) if method_sym.to_s =~ /^(.*)=$/ variable_name = method_sym.to_s.gsub('=', '') @variables[variable_name.to_sym] = arguments[0] else return nil unless @variables.has_key? method_sym @variables[method_sym] end end |
Instance Attribute Details
#company_name ⇒ Object
Returns the value of attribute company_name.
2 3 4 |
# File 'app/models/block/common/configuration.rb', line 2 def company_name @company_name end |
#copyright_date ⇒ Object
Returns the value of attribute copyright_date.
2 3 4 |
# File 'app/models/block/common/configuration.rb', line 2 def copyright_date @copyright_date end |