Class: EasyDom
- Inherits:
-
Object
- Object
- EasyDom
- Defined in:
- lib/easydom.rb
Instance Method Summary collapse
-
#initialize(obj, debug: false) ⇒ EasyDom
constructor
A new instance of EasyDom.
- #method_missing(sym, *args, &block) ⇒ Object
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/easydom.rb', line 18 def method_missing(sym, *args, &block) puts "name: %s; args: %s" % [sym, args.inspect] if @debug if @e.respond_to? sym then puts 'attribute found' if @debug @e.method(sym).call(*args) else e = @e.element(sym.to_s) EasyDom.new(e, debug: @debug) if e end end |