Class: Hexp::Builder::NodeBuilder Private
- Inherits:
-
Object
- Object
- Hexp::Builder::NodeBuilder
- Defined in:
- lib/hexp/builder.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Allow setting HTML classes through method calls
Instance Method Summary collapse
-
#initialize(node, builder) ⇒ NodeBuilder
constructor
private
Create new NodeBuilder.
-
#method_missing(sym, &block) ⇒ Hexp::Builder::NodeBuilder
Used for specifying CSS class names.
Constructor Details
#initialize(node, builder) ⇒ NodeBuilder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create new NodeBuilder
202 203 204 |
# File 'lib/hexp/builder.rb', line 202 def initialize(node, builder) @node, @builder = node, builder end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, &block) ⇒ Hexp::Builder::NodeBuilder
Used for specifying CSS class names
218 219 220 221 222 223 |
# File 'lib/hexp/builder.rb', line 218 def method_missing(sym, &block) attrs = @node[1] @node[1] = attrs.merge class: [attrs[:class], sym.to_s].compact.join(' ') @builder._process(&block) if block self end |