lib/prospectus/state.rb in prospectus-0.0.5 vs lib/prospectus/state.rb in prospectus-0.0.6
- old
+ new
@@ -5,9 +5,17 @@
attr_accessor :value
def initialize(params = {})
@options = params
end
+
+ 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
end
##
# DSL for wrapping eval of states
class StateDSL