Class: Immutabler::DSL::PropsBuilder
- Inherits:
-
Object
- Object
- Immutabler::DSL::PropsBuilder
- Defined in:
- lib/immutabler/dsl/props_builder.rb
Instance Method Summary collapse
-
#initialize(props, &block) ⇒ PropsBuilder
constructor
A new instance of PropsBuilder.
- #prop(name, type, options = {}) ⇒ Object
Constructor Details
#initialize(props, &block) ⇒ PropsBuilder
Returns a new instance of PropsBuilder.
6 7 8 9 |
# File 'lib/immutabler/dsl/props_builder.rb', line 6 def initialize(props, &block) @props = props instance_eval(&block) end |
Instance Method Details
#prop(name, type, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/immutabler/dsl/props_builder.rb', line 11 def prop(name, type, ={}) = {} [:is_ref] = [:is_ref] if .key?(:is_ref) [:ref_type] = [:ref_type] if .key?(:ref_type) [:name_prefix] = [:name_prefix] if .key?(:name_prefix) [:is_id] = [:is_id] if .key?(:is_id) @props << Prop.new(name.to_s, type.to_s, ) end |