Sha256: 677d9e7bf1ff3519ff57ec23a99fc000fb411429c3af6c546eadb942e00d5805

Contents?: true

Size: 967 Bytes

Versions: 3

Compression:

Stored size: 967 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

3 entries across 3 versions & 1 rubygems

Version Path
ginjo-rfm-3.0.12 lib/rfm/metadata/layout_meta.rb
ginjo-rfm-3.0.11 lib/rfm/metadata/layout_meta.rb
ginjo-rfm-3.0.10 lib/rfm/metadata/layout_meta.rb