Method: Origami::StandardObject::ClassMethods#field
- Defined in:
- lib/origami/object.rb
#field(name, attributes) ⇒ Object
Define a new field with given attributes.
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/origami/object.rb', line 184 def field(name, attributes) if attributes[:Required] and attributes.key?(:Default) and attributes[:Type] == Name signature = {} signature[name] = attributes[:Default] add_type_signature(**signature) end if @fields.key?(name) @fields[name].merge! attributes else @fields[name] = attributes end define_field_methods(name) end |