Module: Ordinary::Composable
Instance Method Summary collapse
- #<<(other) ⇒ Object
- #>>(other) ⇒ Object (also: #|)
- #instance_id ⇒ Object
- #owned? ⇒ Boolean
- #owned_by(mod, name) ⇒ Object
- #owner ⇒ Object
Instance Method Details
#<<(other) ⇒ Object
8 9 10 |
# File 'lib/ordinary/unit.rb', line 8 def <<(other) other >> self end |
#>>(other) ⇒ Object Also known as: |
3 4 5 |
# File 'lib/ordinary/unit.rb', line 3 def >>(other) Units.new([*self, *other]) end |
#instance_id ⇒ Object
25 26 27 |
# File 'lib/ordinary/unit.rb', line 25 def instance_id "#{self.class.name}:0x%014x" % (object_id << 1) end |
#owned? ⇒ Boolean
21 22 23 |
# File 'lib/ordinary/unit.rb', line 21 def owned? @module and @name end |
#owned_by(mod, name) ⇒ Object
16 17 18 19 |
# File 'lib/ordinary/unit.rb', line 16 def owned_by(mod, name) @module = mod @name = name end |
#owner ⇒ Object
12 13 14 |
# File 'lib/ordinary/unit.rb', line 12 def owner owned? ? "#{@module.name}##{@name}" : 'owner unknown' end |