Module: NudgeType::TypeBehaviors

Included in:
BoolType, CodeType, FloatType, IntType, ProportionType
Defined in:
lib/interpreter/types/pushTypes.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(subclass) ⇒ Object



14
15
16
# File 'lib/interpreter/types/pushTypes.rb', line 14

def self.extended(subclass)
  NudgeType.all_types << subclass
end

Instance Method Details

#any_valueObject



30
31
32
# File 'lib/interpreter/types/pushTypes.rb', line 30

def any_value
  raise "This class must implement #{self.inspect}.any_value"
end

#from_s(some_string) ⇒ Object



22
23
24
# File 'lib/interpreter/types/pushTypes.rb', line 22

def from_s(some_string)
  raise "This class must implement #{self.inspect}.from_s"
end

#random_value(params) ⇒ Object



34
35
36
# File 'lib/interpreter/types/pushTypes.rb', line 34

def random_value(params)
  raise "This class must implement #{self.inspect}.random_value"
end

#recognizes?(some_representation) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/interpreter/types/pushTypes.rb', line 26

def recognizes?(some_representation)
  raise "This class should implement #{self.inspect}.recognizes?"
end

#to_nudgecodeObject



18
19
20
# File 'lib/interpreter/types/pushTypes.rb', line 18

def to_nudgecode
  self.to_s.demodulize.slice(0..-5).downcase.intern
end