Class: Luoma::BlockDrop
- Defined in:
- lib/luoma/drops/block.rb,
sig/luoma/drops/block.rbs
Instance Method Summary collapse
-
#initialize(block) ⇒ BlockDrop
constructor
(t_block) -> void.
- #render(context) ⇒ string
- #to_primitive(hint, context) ⇒ Object
Methods inherited from Drop
#contains?, #each, #eq?, #fetch, #gt?, #key?, #length, #lt?, #slice, #to_a, #to_s
Constructor Details
#initialize(block) ⇒ BlockDrop
(t_block) -> void
6 7 8 9 |
# File 'lib/luoma/drops/block.rb', line 6 def initialize(block) super() @block = block end |
Instance Method Details
#render(context) ⇒ string
23 24 25 26 27 28 29 30 31 |
# File 'lib/luoma/drops/block.rb', line 23 def render(context) buf = +"" context.extends({}) do # For recursive block detection. Luoma.render_block(@block, context, buf) end buf end |
#to_primitive(hint, context) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/luoma/drops/block.rb', line 12 def to_primitive(hint, context) case hint when :numeric :nothing when :data, :string render(context) when :boolean true end end |