Class: Markaby::Fragment
- Defined in:
- lib/gems/markaby-0.5/lib/markaby/builder.rb
Overview
Every tag method in Markaby returns a Fragment. If any method gets called on the Fragment, the tag is removed from the Markaby stream and given back as a string. Usually the fragment is never used, though, and the stream stays intact.
For a more practical explanation, check out the README.
Instance Method Summary collapse
-
#initialize(s, a, b) ⇒ Fragment
constructor
A new instance of Fragment.
- #method_missing(*a) ⇒ Object
Constructor Details
#initialize(s, a, b) ⇒ Fragment
Returns a new instance of Fragment.
275 276 277 |
# File 'lib/gems/markaby-0.5/lib/markaby/builder.rb', line 275 def initialize(s, a, b) @s, @f1, @f2 = s, a, b end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*a) ⇒ Object
278 279 280 281 282 283 284 285 |
# File 'lib/gems/markaby-0.5/lib/markaby/builder.rb', line 278 def method_missing(*a) unless @str @str = @s[@f1, @f2].to_s @s[@f1, @f2] = [nil] * @f2 @str end @str.send(*a) end |