Module: Alf::Support::Bindable
- Included in:
- Algebra::Operand
- Defined in:
- lib/alf-support/alf/support/bindable.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
5 6 7 |
# File 'lib/alf-support/alf/support/bindable.rb', line 5 def connection @connection end |
Instance Method Details
#bind(connection) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/alf-support/alf/support/bindable.rb', line 8 def bind(connection) dup.tap{|c| c.connection = connection yield(c) if block_given? } end |
#bound? ⇒ Boolean
15 16 17 |
# File 'lib/alf-support/alf/support/bindable.rb', line 15 def bound? defined?(@connection) && !@connection.nil? end |
#connection! ⇒ Object
19 20 21 22 |
# File 'lib/alf-support/alf/support/bindable.rb', line 19 def connection! raise UnboundError unless bound? @connection end |