Class: Rfm::Metadata::LayoutMeta

Inherits:
CaseInsensitiveHash show all
Defined in:
lib/rfm/metadata/layout_meta.rb

Instance Method Summary collapse

Methods inherited from CaseInsensitiveHash

#[], #[]=

Methods inherited from Hash

#_create_accessor, #_merge_object!, #rfm_filter, #rfm_only, #to_cih

Constructor Details

#initialize(layout) ⇒ LayoutMeta

Returns a new instance of LayoutMeta.


5
6
7
# File 'lib/rfm/metadata/layout_meta.rb', line 5

def initialize(layout)
	@layout = layout
end

Instance Method Details

#field_controlsObject


9
10
11
# File 'lib/rfm/metadata/layout_meta.rb', line 9

def field_controls
  self['field_controls'] ||= CaseInsensitiveHash.new
end

#field_keysObject


17
18
19
# File 'lib/rfm/metadata/layout_meta.rb', line 17

def field_keys
	field_controls.keys
end

#field_namesObject


13
14
15
# File 'lib/rfm/metadata/layout_meta.rb', line 13

def field_names
	field_controls.values.collect{|v| v.name}
end

#get_mapped_name(name) ⇒ Object

Should this be in FieldControl object?


37
38
39
# File 'lib/rfm/metadata/layout_meta.rb', line 37

def get_mapped_name(name)
	(@layout.field_mapping[name]) || name
end

#receive_field_control(fc) ⇒ Object

def handle_new_field_control(attributes)

name = attributes['name']
field_control = FieldControl.new(attributes, self)
field_controls[get_mapped_name(name)] = field_control

end


31
32
33
34
# File 'lib/rfm/metadata/layout_meta.rb', line 31

def receive_field_control(fc)
  #name = fc.name
  field_controls[get_mapped_name(fc.name)] = fc        
end

#value_listsObject


21
22
23
# File 'lib/rfm/metadata/layout_meta.rb', line 21

def value_lists
				self['value_lists'] ||= CaseInsensitiveHash.new
end