Class: Basic101::BasicObject
- Inherits:
-
Object
- Object
- Basic101::BasicObject
show all
- Defined in:
- lib/basic101/basic_object.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.type_name ⇒ Object
7
8
9
|
# File 'lib/basic101/basic_object.rb', line 7
def self.type_name
name.split('::').last.gsub(/^Basic/, '').downcase
end
|
Instance Method Details
#eval(runtime) ⇒ Object
15
16
17
|
# File 'lib/basic101/basic_object.rb', line 15
def eval(runtime)
self
end
|
#to_float ⇒ Object
27
28
29
|
# File 'lib/basic101/basic_object.rb', line 27
def to_float
raise TypeError, "#{type_name} cannot be converted to float"
end
|
#to_integer ⇒ Object
23
24
25
|
# File 'lib/basic101/basic_object.rb', line 23
def to_integer
raise TypeError, "#{type_name} cannot be converted to integer"
end
|
#to_numeric ⇒ Object
19
20
21
|
# File 'lib/basic101/basic_object.rb', line 19
def to_numeric
raise TypeError, "#{type_name} cannot be converted to numeric"
end
|
#to_string ⇒ Object
31
32
33
|
# File 'lib/basic101/basic_object.rb', line 31
def to_string
raise TypeError, "#{type_name} cannot be converted to string"
end
|
#type_name ⇒ Object
11
12
13
|
# File 'lib/basic101/basic_object.rb', line 11
def type_name
self.class.type_name
end
|