class Immutabler::DSL::PropsBuilder

Public Class Methods

new(props, &block) click to toggle source
# File lib/immutabler/dsl/props_builder.rb, line 6
def initialize(props, &block)
  @props = props
  instance_eval(&block)
end

Public Instance Methods

prop(name, type, options={}) click to toggle source
# File lib/immutabler/dsl/props_builder.rb, line 11
def prop(name, type, options={})
  prop_options = {}
  prop_options[:is_ref] = options[:is_ref] if options.key?(:is_ref)
  prop_options[:ref_type] = options[:ref_type] if options.key?(:ref_type)
  prop_options[:name_prefix] = options[:name_prefix] if options.key?(:name_prefix)
  prop_options[:is_id] = options[:is_id] if options.key?(:is_id)
  @props << Prop.new(name.to_s, type.to_s, prop_options)
end