Class: Mantra::Manifest::RootElement

Inherits:
Element
  • Object
show all
Defined in:
lib/mantra/manifest/root_element.rb

Instance Attribute Summary

Attributes inherited from Element

#content, #parent

Instance Method Summary collapse

Methods inherited from Element

#add_node, #array_selector?, #can_merge?, create, #delete, element_with_selector, #fetch, #find, #get, #has_equal_name?, #has_name?, #hash_selector?, #initialize, #match_selector?, #merge_conflict_error, #method_missing, #name, #path_exist?, #respond_to_missing?, #selector, #split_selector

Methods included from Helpers::RegexpHelper

#to_regexp

Methods included from Helpers::ObjectWithType

included

Constructor Details

This class inherits a constructor from Mantra::Manifest::Element

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Mantra::Manifest::Element

Instance Method Details

#childObject



28
29
30
# File 'lib/mantra/manifest/root_element.rb', line 28

def child
  self.content
end

#childrenObject



32
33
34
# File 'lib/mantra/manifest/root_element.rb', line 32

def children
  self.content
end

#content=(content) ⇒ Object



7
8
9
# File 'lib/mantra/manifest/root_element.rb', line 7

def content=(content)
  @content = Element.create(content, self)
end

#merge(element, options = {}) ⇒ Object



15
16
17
18
# File 'lib/mantra/manifest/root_element.rb', line 15

def merge(element, options={})
  raise merge_conflict_error(element) unless self.can_merge?(element)
  self.content.merge(element.content, options)
end

#pathObject



11
12
13
# File 'lib/mantra/manifest/root_element.rb', line 11

def path
  ""
end

#to_ruby_objectObject



20
21
22
# File 'lib/mantra/manifest/root_element.rb', line 20

def to_ruby_object
  self.content.to_ruby_object
end

#traverse(&block) ⇒ Object



24
25
26
# File 'lib/mantra/manifest/root_element.rb', line 24

def traverse(&block)
  self.content.traverse(&block)
end