Class: ViewModel::Config
- Inherits:
-
Object
- Object
- ViewModel::Config
- Defined in:
- lib/view_model/config.rb
Class Method Summary collapse
Class Method Details
._option(opt) ⇒ Object
25 26 27 28 |
# File 'lib/view_model/config.rb', line 25 def self._option(opt) configure! unless configured? @instance[opt] end |
.configure!(&block) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/view_model/config.rb', line 12 def self.configure!(&block) if configured? raise ArgumentError.new('ViewModel library already configured') end builder = KeywordBuilder.create(self, constructor: :with) @instance = builder.build!(&block) end |
.configured? ⇒ Boolean
21 22 23 |
# File 'lib/view_model/config.rb', line 21 def self.configured? instance_variable_defined?(:@instance) end |