Class: Liquid::Pry::Tag
- Inherits:
-
Tag
- Object
- Tag
- Liquid::Pry::Tag
- Defined in:
- lib/liquid/pry/tag.rb
Overview
Interrupts rendering, allowing user to inspect or modify the context.
Instance Attribute Summary collapse
-
#once ⇒ Object
readonly
Returns the value of attribute once.
-
#visited ⇒ Object
readonly
Returns the value of attribute visited.
Instance Method Summary collapse
-
#initialize(tag_name, text, tokens) ⇒ Tag
constructor
A new instance of Tag.
- #parse_args(args_str) ⇒ Object
- #render(context) ⇒ Object
- #set_once ⇒ Object
Constructor Details
#initialize(tag_name, text, tokens) ⇒ Tag
Returns a new instance of Tag.
14 15 16 17 18 |
# File 'lib/liquid/pry/tag.rb', line 14 def initialize(tag_name, text, tokens) super @visited = false parse_args(text) end |
Instance Attribute Details
#once ⇒ Object (readonly)
Returns the value of attribute once.
11 12 13 |
# File 'lib/liquid/pry/tag.rb', line 11 def once @once end |
#visited ⇒ Object (readonly)
Returns the value of attribute visited.
12 13 14 |
# File 'lib/liquid/pry/tag.rb', line 12 def visited @visited end |
Instance Method Details
#parse_args(args_str) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/liquid/pry/tag.rb', line 20 def parse_args(args_str) case args_str.strip when "" return when "once" set_once else raise( ArgumentError, "Arguments passed to pry tag could not be recognized: #{args_str}", ) end end |
#render(context) ⇒ Object
38 39 40 41 42 |
# File 'lib/liquid/pry/tag.rb', line 38 def render(context) binding.pry unless once && visited @visited = true "" end |
#set_once ⇒ Object
34 35 36 |
# File 'lib/liquid/pry/tag.rb', line 34 def set_once @once = true end |