Class: Trundle::Config
- Inherits:
-
Object
- Object
- Trundle::Config
- Defined in:
- lib/trundle/config.rb
Instance Attribute Summary collapse
-
#creator_identifier ⇒ Object
Returns the value of attribute creator_identifier.
-
#creator_url ⇒ Object
Returns the value of attribute creator_url.
-
#source_url ⇒ Object
Returns the value of attribute source_url.
-
#transient ⇒ Object
Returns the value of attribute transient.
-
#type ⇒ Object
Returns the value of attribute type.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #namespace?(name) ⇒ Boolean
- #namespace_key(name) ⇒ Object
- #namespaces(&block) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
11 12 13 14 |
# File 'lib/trundle/config.rb', line 11 def initialize @version = 2 @transient = false end |
Instance Attribute Details
#creator_identifier ⇒ Object
Returns the value of attribute creator_identifier.
2 3 4 |
# File 'lib/trundle/config.rb', line 2 def creator_identifier @creator_identifier end |
#creator_url ⇒ Object
Returns the value of attribute creator_url.
2 3 4 |
# File 'lib/trundle/config.rb', line 2 def creator_url @creator_url end |
#source_url ⇒ Object
Returns the value of attribute source_url.
2 3 4 |
# File 'lib/trundle/config.rb', line 2 def source_url @source_url end |
#transient ⇒ Object
Returns the value of attribute transient.
2 3 4 |
# File 'lib/trundle/config.rb', line 2 def transient @transient end |
#type ⇒ Object
Returns the value of attribute type.
2 3 4 |
# File 'lib/trundle/config.rb', line 2 def type @type end |
#version ⇒ Object
Returns the value of attribute version.
2 3 4 |
# File 'lib/trundle/config.rb', line 2 def version @version end |
Instance Method Details
#namespace?(name) ⇒ Boolean
16 17 18 |
# File 'lib/trundle/config.rb', line 16 def namespace?(name) namespace_list.include?(name) end |
#namespace_key(name) ⇒ Object
20 21 22 |
# File 'lib/trundle/config.rb', line 20 def namespace_key(name) namespace_list.key(name) end |
#namespaces(&block) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/trundle/config.rb', line 24 def namespaces(&block) if block_given? namespace_list.instance_eval(&block) else namespace_list.all end end |
#to_h ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/trundle/config.rb', line 37 def to_h hash = {} keys.each do |key| value = send(key) hash[Trundle::Key.new(key).camelize] = value if !value.nil? end hash end |