Class: Reamaze::Opinionated::Configuration
- Inherits:
-
Object
- Object
- Reamaze::Opinionated::Configuration
- Defined in:
- lib/opinionated/configuration.rb
Instance Attribute Summary collapse
-
#definitions ⇒ Object
Returns the value of attribute definitions.
Instance Method Summary collapse
- #define(preferential, options = {}) ⇒ Object
-
#initialize(klass, preferential, options) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(klass, preferential, options) ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 9 10 |
# File 'lib/opinionated/configuration.rb', line 6 def initialize(klass, preferential, ) @klass = klass @preferential = preferential @definitions = {} end |
Instance Attribute Details
#definitions ⇒ Object
Returns the value of attribute definitions.
4 5 6 |
# File 'lib/opinionated/configuration.rb', line 4 def definitions @definitions end |
Instance Method Details
#define(preferential, options = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/opinionated/configuration.rb', line 12 def define(preferential, = {}) preferential = Helpers.normalize(preferential) raise ArgumentError, "#{@klass} already defines preferences :#{preferential}" if @definitions.has_key?(preferential) @definitions[preferential] = Definition.new(preferential, ) end |