Sha256: 218e25127689b2d9b70f4825775d5d3dcf27905f365f91d6356f4c52d4dd4d73

Contents?: true

Size: 569 Bytes

Versions: 5

Compression:

Stored size: 569 Bytes

Contents

require 'diecut/configurable'
module Diecut
  class UIConfig < Configurable
    class << self
      def options_hash
        @options_hash ||= {}
      end

      def description(name)
        @options_hash.fetch(name).description
      end

      def required?(name)
        field_metadata(name).is?(:required)
      end

      def default_for(name)
        field_metadata(name).default_value
      end
    end

    def initialize
      super
      setup_defaults
    end

    def get_value(name)
      self.class.field_metadata(name).value_on(self)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
diecut-0.0.5 lib/diecut/ui-config.rb
diecut-0.0.4 lib/diecut/ui-config.rb
diecut-0.0.3 lib/diecut/ui-config.rb
diecut-0.0.2 lib/diecut/ui-config.rb
diecut-0.0.1 lib/diecut/ui-config.rb