Class: Weskit::WML::Root

Inherits:
Items show all
Includes:
Mixins::Searchable, Mixins::Validator
Defined in:
lib/weskit/wml/root.rb

Instance Attribute Summary

Attributes inherited from Items

#contents

Instance Method Summary collapse

Methods included from Mixins::Searchable

#elements_recursively, #find_recursively

Methods included from Mixins::Validator

raise_if_invalid, raise_if_missing, raise_unless

Methods inherited from Items

#formatter, #formatter=, #initialize, #to_s

Methods included from Mixins::Container

#[], #attributes, #build, #delete, #elements, #exists?, #push

Constructor Details

This class inherits a constructor from Weskit::WML::Items

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missingObject



15
16
17
# File 'lib/weskit/wml/root.rb', line 15

def find name, nested = false
  find_elements name, nested
end

Instance Method Details

#<<(item) ⇒ Object



5
6
7
8
9
# File 'lib/weskit/wml/root.rb', line 5

def << item
  raise_unless Item, item
  (append? item) ? append(item) : add(item)
  self
end

#find(name, nested = false) ⇒ Object Also known as: method_missing



11
12
13
# File 'lib/weskit/wml/root.rb', line 11

def find name, nested = false
  find_elements name, nested
end