Class: Plugs::Plug

Inherits:
Object
  • Object
show all
Defined in:
lib/plug.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#childrenObject (readonly)

Returns the value of attribute children.



5
6
7
# File 'lib/plug.rb', line 5

def children
  @children
end

#keyObject (readonly)

Returns the value of attribute key.



5
6
7
# File 'lib/plug.rb', line 5

def key
  @key
end

Instance Method Details

#resultObject



14
15
16
# File 'lib/plug.rb', line 14

def result
  @result ||= @proc.call
end