Module: Ordinary::Composable

Included in:
Unit, Units
Defined in:
lib/ordinary/unit.rb

Instance Method Summary collapse

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_idObject



25
26
27
# File 'lib/ordinary/unit.rb', line 25

def instance_id
  "#{self.class.name}:0x%014x" % (object_id << 1)
end

#owned?Boolean

Returns:

  • (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

#ownerObject



12
13
14
# File 'lib/ordinary/unit.rb', line 12

def owner
  owned? ? "#{@module.name}##{@name}" : 'owner unknown'
end