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
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
Instance Method Summary collapse
- #cache_key ⇒ Object
-
#initialize(keys) ⇒ Index
constructor
A new instance of Index.
Constructor Details
#initialize(keys) ⇒ Index
Returns a new instance of Index.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fusuma/config/index.rb', line 8 def initialize(keys) @keys = case keys when Array keys.map do |key| if key.is_a? Key key else Key.new(key) end end else [Key.new(keys)] end end |
Instance Attribute Details
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
22 23 24 |
# File 'lib/fusuma/config/index.rb', line 22 def keys @keys end |
Instance Method Details
#cache_key ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fusuma/config/index.rb', line 24 def cache_key case @keys when Array @keys.map(&:symbol).join(',') when Key @keys.symbol else raise 'invalid keys' end end |