Sha256: c4646b5f9625f64f35247db35edd237895af87c4ccd1ad97efa1f27a1ddc55b8

Contents?: true

Size: 603 Bytes

Versions: 1

Compression:

Stored size: 603 Bytes

Contents

module Cavy
  class Templates
    attr_reader :options

    @options = {
      string: { type: 'STRING', localize: true },
      text: { type: 'TEXT', localize: true },
      picture: { type: 'PICTURE', localize: false }
    }

    def self.localize?(option)
      value = get_option_value(option, :localize)
      return true if value
      false
    end

    def self.select_options
      @options.map { |k, v| [k.to_s, v[:type]] }
    end

    def self.get_option_value(option, field)
      return nil unless @options.key?(option.to_sym)
      @options[option.to_sym][field.to_sym]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cavy-0.1.0.beta2 lib/cavy/templates.rb