Sha256: d5274649bf4307146bd8ca39e1e1ceaf764301432fc3cb854c9a2529e4fba7da

Contents?: true

Size: 965 Bytes

Versions: 5

Compression:

Stored size: 965 Bytes

Contents

module Rfm
	module Metadata
		class LayoutMeta < CaseInsensitiveHash
			
			def initialize(layout)
				@layout = layout
			end
			
	    def field_controls
	      self['field_controls'] ||= CaseInsensitiveHash.new
	    end
	    
	  	def field_names
	  		field_controls.values.collect{|v| v.name}
	  	end
			
	  	def field_keys
	  		field_controls.keys
	  	end
	  	
	    def value_lists
				self['value_lists'] ||= CaseInsensitiveHash.new
	    end
	    
      # def handle_new_field_control(attributes)
      #   name = attributes['name']
      #   field_control = FieldControl.new(attributes, self)
      #   field_controls[get_mapped_name(name)] = field_control
      # end
      
      def receive_field_control(fc)
        #name = fc.name
        field_controls[get_mapped_name(fc.name)] = fc        
      end
			
			# Should this be in FieldControl object?
      def get_mapped_name(name)
      	(@layout.field_mapping[name]) || name
      end
		
		end
	end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ginjo-rfm-3.0.9 lib/rfm/metadata/layout_meta.rb
ginjo-rfm-3.0.8 lib/rfm/metadata/layout_meta.rb
ginjo-rfm-3.0.7 lib/rfm/metadata/layout_meta.rb
ginjo-rfm-3.0.6 lib/rfm/metadata/layout_meta.rb
ginjo-rfm-3.0.5 lib/rfm/metadata/layout_meta.rb