Sha256: 9af09f55c3d13cd8d0460dfd30c3ee97161e9ee1282cea2c28eefabcd351ceba
Contents?: true
Size: 767 Bytes
Versions: 4
Compression:
Stored size: 767 Bytes
Contents
# frozen_string_literal: true module Loaf class Configuration VALID_ATTRIBUTES = [ :locales_path, :match ].freeze attr_accessor(*VALID_ATTRIBUTES) DEFAULT_LOCALES_PATH = '/' DEFAULT_MATCH = :inclusive # Setup this configuration # # @api public def initialize(attributes = {}) VALID_ATTRIBUTES.each do |attr| default = self.class.const_get("DEFAULT_#{attr.to_s.upcase}") attr_value = attributes.fetch(attr) { default } send("#{attr}=", attr_value) end end # Convert all properties into hash # # @return [Hash] # # @api public def to_hash VALID_ATTRIBUTES.reduce({}) { |acc, k| acc[k] = send(k); acc } end end # Configuration end # Loaf
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
loaf-0.10.0 | lib/loaf/configuration.rb |
loaf-0.9.0 | lib/loaf/configuration.rb |
loaf-0.8.1 | lib/loaf/configuration.rb |
loaf-0.8.0 | lib/loaf/configuration.rb |