Module: Extree::Root

Includes:
Seed
Included in:
Extree
Defined in:
lib/extree/root.rb

Constant Summary

Constants included from Seed

Seed::BRANCH_METHOD_PREFIX

Instance Method Summary collapse

Methods included from Seed

close_scope, current, #extree_method_missing, #extree_respond_to?, open_scope, pop, push, roots, #scope!, #self!, #send!, stack

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *a, **na, &b) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/extree/root.rb', line 11

def method_missing name, *a, **na, &b
  if name.end_with? "!"
    extree_method_missing name[...-1], *a, **na, &b
  else 
    super
  end
end

Instance Method Details

#host!(*a, **na, &b) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/extree/root.rb', line 19

def host! *a, **na, &b
  a.each do |k|
    send("#{k}=", SINGLETON)
  end
  na.each do |k, v|
    send("#{k}=", v)
  end
  super(&b)
end

#respond_to?(name) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/extree/root.rb', line 7

def respond_to? name
  super || (name.end_with?("!") && extree_respond_to?(name[...-1]))
end