Class: LocalObject
Overview
Object, whose business is to stay local to methods. Optional signature provides additional level of safety in ensuring object locality. (Signature accessor is :signature, aliased as :σ, small Greek sigma.)
Instance Attribute Summary collapse
-
#signature ⇒ Object
(also: #σ)
readonly
Returns the value of attribute signature.
Instance Method Summary collapse
-
#initialize(signature = caller_locations( 1, 1 )[0].label) ⇒ LocalObject
constructor
Optional argument signature provides additional level of safety in ascertaining that the object indeed is of local origin.
-
#local_object?(signature = caller_locations( 1, 1 )[0].label) ⇒ Boolean
(also: #ℓ?)
True if the (optional) signature matches.
Constructor Details
#initialize(signature = caller_locations( 1, 1 )[0].label) ⇒ LocalObject
Optional argument signature provides additional level of safety in ascertaining that the object indeed is of local origin.
16 17 18 |
# File 'lib/y_support/local_object.rb', line 16 def initialize signature=caller_locations( 1, 1 )[0].label @signature = signature end |
Instance Attribute Details
#signature ⇒ Object (readonly) Also known as: σ
Returns the value of attribute signature.
10 11 12 |
# File 'lib/y_support/local_object.rb', line 10 def signature @signature end |
Instance Method Details
#local_object?(signature = caller_locations( 1, 1 )[0].label) ⇒ Boolean Also known as: ℓ?
True if the (optional) signature matches.
22 23 24 |
# File 'lib/y_support/local_object.rb', line 22 def local_object? signature=caller_locations( 1, 1 )[0].label signature == self.signature end |