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
5
6
7
|
# File 'lib/basic101/basic_object.rb', line 5
def self.type_name
name.split('::').last.gsub(/^Basic/, '').downcase
end
|
Instance Method Details
#eval(runtime) ⇒ Object
13
14
15
|
# File 'lib/basic101/basic_object.rb', line 13
def eval(runtime)
self
end
|
#to_float ⇒ Object
25
26
27
|
# File 'lib/basic101/basic_object.rb', line 25
def to_float
raise TypeError, "#{type_name} cannot be converted to float"
end
|
#to_integer ⇒ Object
21
22
23
|
# File 'lib/basic101/basic_object.rb', line 21
def to_integer
raise TypeError, "#{type_name} cannot be converted to integer"
end
|
#to_numeric ⇒ Object
17
18
19
|
# File 'lib/basic101/basic_object.rb', line 17
def to_numeric
raise TypeError, "#{type_name} cannot be converted to numeric"
end
|
#to_string ⇒ Object
29
30
31
|
# File 'lib/basic101/basic_object.rb', line 29
def to_string
raise TypeError, "#{type_name} cannot be converted to string"
end
|
#type_name ⇒ Object
9
10
11
|
# File 'lib/basic101/basic_object.rb', line 9
def type_name
self.class.type_name
end
|