Class: Cooltrainer::DistorteD::KEY

Inherits:
Struct
  • Object
show all
Defined in:
lib/distorted/media_molecule.rb

Overview

Reusable IMPLANTATION Hash key, since instances of the same Struct subclass are equal: irb> Pair = Struct.new(:uno, :dos) irb> lol = Pair.new(:a, 1) irb> rofl = Pair.new(:a, 1) irb> lol === rofl

> true

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(molecule, constant, inherit = true) ⇒ KEY

Descend into ancestor Modules by default.



28
# File 'lib/distorted/media_molecule.rb', line 28

def initialize(molecule, constant, inherit = true); super(molecule, constant, inherit); end

Instance Attribute Details

#constantObject

Returns the value of attribute constant

Returns:

  • (Object)

    the current value of constant



26
27
28
# File 'lib/distorted/media_molecule.rb', line 26

def constant
  @constant
end

#inheritObject

Returns the value of attribute inherit

Returns:

  • (Object)

    the current value of inherit



26
27
28
# File 'lib/distorted/media_molecule.rb', line 26

def inherit
  @inherit
end

#moleculeObject

Returns the value of attribute molecule

Returns:

  • (Object)

    the current value of molecule



26
27
28
# File 'lib/distorted/media_molecule.rb', line 26

def molecule
  @molecule
end

Instance Method Details

#inspectObject



29
# File 'lib/distorted/media_molecule.rb', line 29

def inspect; "#{molecule}#{''.freeze if inherit}::#{constant}"; end