Class: Toaster::MarkupUtil::DynTravers
- Inherits:
-
Object
- Object
- Toaster::MarkupUtil::DynTravers
- Defined in:
- lib/toaster/markup/markup_util.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(expr) ⇒ DynTravers
constructor
A new instance of DynTravers.
- #method_missing(m, *args, &block) ⇒ Object
Constructor Details
#initialize(expr) ⇒ DynTravers
Returns a new instance of DynTravers.
255 256 257 258 |
# File 'lib/toaster/markup/markup_util.rb', line 255 def initialize(expr) @path = [] eval(expr) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
259 260 261 262 263 264 265 266 |
# File 'lib/toaster/markup/markup_util.rb', line 259 def method_missing(m, *args, &block) if m == :[] @path << args[0] else @path << m.to_s end self end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
254 255 256 |
# File 'lib/toaster/markup/markup_util.rb', line 254 def path @path end |