Class: Trundle::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/trundle/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

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_identifierObject

Returns the value of attribute creator_identifier.



2
3
4
# File 'lib/trundle/config.rb', line 2

def creator_identifier
  @creator_identifier
end

#creator_urlObject

Returns the value of attribute creator_url.



2
3
4
# File 'lib/trundle/config.rb', line 2

def creator_url
  @creator_url
end

#source_urlObject

Returns the value of attribute source_url.



2
3
4
# File 'lib/trundle/config.rb', line 2

def source_url
  @source_url
end

#transientObject

Returns the value of attribute transient.



2
3
4
# File 'lib/trundle/config.rb', line 2

def transient
  @transient
end

#typeObject

Returns the value of attribute type.



2
3
4
# File 'lib/trundle/config.rb', line 2

def type
  @type
end

#versionObject

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

Returns:

  • (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_hObject



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