Module: Cot::FrameClassMethods

Included in:
Frame
Defined in:
lib/cot/frame_class_methods.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attr_methodsObject

Returns the value of attribute attr_methods.



3
4
5
# File 'lib/cot/frame_class_methods.rb', line 3

def attr_methods
  @attr_methods
end

#inverted_mappingsObject

Returns the value of attribute inverted_mappings.



3
4
5
# File 'lib/cot/frame_class_methods.rb', line 3

def inverted_mappings
  @inverted_mappings
end

#inverted_search_mappingsObject

Returns the value of attribute inverted_search_mappings.



3
4
5
# File 'lib/cot/frame_class_methods.rb', line 3

def inverted_search_mappings
  @inverted_search_mappings
end

#mappingsObject

Returns the value of attribute mappings.



3
4
5
# File 'lib/cot/frame_class_methods.rb', line 3

def mappings
  @mappings
end

#missing_blocksObject

Returns the value of attribute missing_blocks.



3
4
5
# File 'lib/cot/frame_class_methods.rb', line 3

def missing_blocks
  @missing_blocks
end

#primary_keyObject

Returns the value of attribute primary_key.



3
4
5
# File 'lib/cot/frame_class_methods.rb', line 3

def primary_key
  @primary_key
end

#search_mappingsObject

Returns the value of attribute search_mappings.



3
4
5
# File 'lib/cot/frame_class_methods.rb', line 3

def search_mappings
  @search_mappings
end

#value_blocksObject

Returns the value of attribute value_blocks.



3
4
5
# File 'lib/cot/frame_class_methods.rb', line 3

def value_blocks
  @value_blocks
end

Instance Method Details

#enum(name, &block) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/cot/frame_class_methods.rb', line 17

def enum(name, &block)
  obj = Enum.new
  obj.instance_eval(&block)
  define_singleton_method name do
    obj
  end
  define_method name do
    obj
  end
end

#property(name, args = {}, &block) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/cot/frame_class_methods.rb', line 28

def property(name, args = {}, &block)
  set_default_values
  prop = Property.new args
  prop.instance_eval(&block) if block

  set_blocks(name, prop)
  set_mappings(name, prop)
  @primary_key = name if prop.primary?

  define_property_methods name
end

#search_property(name, args = {}) ⇒ Object



12
13
14
15
# File 'lib/cot/frame_class_methods.rb', line 12

def search_property(name, args = {})
  key = args[:from] ? args[:from] : name
  @search_mappings[name] = key
end