Class: Plugs::Plug
- Inherits:
-
Object
- Object
- Plugs::Plug
- Defined in:
- lib/plug.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
-
#initialize(key:, &block) ⇒ Plug
constructor
A new instance of Plug.
- #result ⇒ Object
Constructor Details
#initialize(key:, &block) ⇒ Plug
Returns a new instance of Plug.
7 8 9 10 11 12 |
# File 'lib/plug.rb', line 7 def initialize(key:, &block) @key = key @proc = block @result = nil @children = [] end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
5 6 7 |
# File 'lib/plug.rb', line 5 def children @children end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
5 6 7 |
# File 'lib/plug.rb', line 5 def key @key end |
Instance Method Details
#result ⇒ Object
14 15 16 |
# File 'lib/plug.rb', line 14 def result @result ||= @proc.call end |