Class: Fusuma::Config::Index
- Inherits:
-
Object
- Object
- Fusuma::Config::Index
- Defined in:
- lib/fusuma/config/index.rb
Overview
index for config.yml
Defined Under Namespace
Classes: Key
Instance Attribute Summary collapse
-
#cache_key ⇒ Object
readonly
: Symbol | Integer.
-
#keys ⇒ Object
readonly
: Array.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(keys) ⇒ Index
constructor
: (Array | String | Symbol | Integer) -> void.
- #to_s ⇒ Object
Constructor Details
#initialize(keys) ⇒ Index
: (Array | String | Symbol | Integer) -> void
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fusuma/config/index.rb', line 9 def initialize(keys) case keys when Array @keys = [] @cache_key = keys.map do |key| key = Key.new(key) if !key.is_a? Key @keys << key key.symbol end.join(",").to_sym else key = Key.new(keys) @cache_key = key.symbol @keys = [key] end end |
Instance Attribute Details
#cache_key ⇒ Object (readonly)
: Symbol | Integer
26 27 28 |
# File 'lib/fusuma/config/index.rb', line 26 def cache_key @cache_key end |
#keys ⇒ Object (readonly)
: Array
25 26 27 |
# File 'lib/fusuma/config/index.rb', line 25 def keys @keys end |
Instance Method Details
#==(other) ⇒ Object
32 33 34 35 36 |
# File 'lib/fusuma/config/index.rb', line 32 def ==(other) return false unless other.is_a? Index cache_key == other.cache_key end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/fusuma/config/index.rb', line 28 def to_s @keys.map(&:inspect) end |