Module: Ladder::Resource::Dynamic

Extended by:
ActiveSupport::Concern
Defined in:
lib/ladder/resource/dynamic.rb

Defined Under Namespace

Modules: InstanceMethods

Instance Method Summary collapse

Instance Method Details

#property(field_name, *opts) ⇒ Object

Dynamic field definition



15
16
17
18
19
20
21
22
23
24
# File 'lib/ladder/resource/dynamic.rb', line 15

def property(field_name, *opts)
  # Store context information
  self._context ||= Hash.new(nil)

  # Ensure new field name is unique
  field_name = opts.first[:predicate].qname.join('_').to_sym if respond_to? field_name or :name == field_name
  self._context[field_name] = opts.first[:predicate].to_s

  apply_context
end