Class: Prospectus::State

Inherits:
Object
  • Object
show all
Defined in:
lib/prospectus/state.rb

Overview

Define a state object that supports modular checks

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ State

Returns a new instance of State.



7
8
9
# File 'lib/prospectus/state.rb', line 7

def initialize(params = {})
  @options = params
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/prospectus/state.rb', line 5

def value
  @value
end

Class Method Details

.from_block(params = {}, state = nil, &block) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/prospectus/state.rb', line 11

def self.from_block(params = {}, state = nil, &block)
  state ||= State.new(params)
  dsl = StateDSL.new(state, params)
  dsl.instance_eval(&block)
  dsl.load!
  state
end