Sha256: 68bf40f2811c38f57612c65f355cfbc9fa74c086d0ab5976fcb5c79e9088c4ea

Contents?: true

Size: 712 Bytes

Versions: 8

Compression:

Stored size: 712 Bytes

Contents

require 'ziya/maps/support/base'

module Ziya::Maps::Support
  class Range < Base
    class << self
      def define_mappings( mappings )
        @mappings = mappings
      end
      
      def mappings
        @mappings
      end
    end
    
    has_attribute   :color, :level
    define_mappings :level => :data
    
    def flatten( xml )
      xml.state( :id => to_component_id ) do |b|
        options.keys.sort { |a,b| a.to_s <=> b.to_s }.each { |k| self.class.module_eval "xml.#{find_key_for_attr(k)}( '#{options[k]}' )" }
      end
    end
    
    private
            
      def find_key_for_attr( k )
        return Range.mappings[k] if Range.mappings.has_key? k 
        k
      end        
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
derailed-ziya-2.1.0 lib/ziya/maps/support/range.rb
derailed-ziya-2.1.1 lib/ziya/maps/support/range.rb
derailed-ziya-2.1.2 lib/ziya/maps/support/range.rb
derailed-ziya-2.1.3 lib/ziya/maps/support/range.rb
derailed-ziya-2.1.4 lib/ziya/maps/support/range.rb
derailed-ziya-2.1.5 lib/ziya/maps/support/range.rb
ziya-2.1.7 lib/ziya/maps/support/range.rb
ziya-2.1.6 lib/ziya/maps/support/range.rb