Class: Astroscript::ConstBody::NullCalc
- Inherits:
-
Object
- Object
- Astroscript::ConstBody::NullCalc
show all
- Defined in:
- lib/astroscript/body/const_body.rb
Overview
Silently ignores any method call
Instance Method Summary
collapse
Constructor Details
#initialize(lon) ⇒ NullCalc
Returns a new instance of NullCalc.
25
26
27
|
# File 'lib/astroscript/body/const_body.rb', line 25
def initialize(lon)
@lon = lon
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *_args) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/astroscript/body/const_body.rb', line 33
def method_missing(method_name, *_args)
case method_name
when %i[to_f]
0.0
when %i[to_i + - / * %]
0
when :prefix
""
else
self
end
end
|
Instance Method Details
#coerce(_other) ⇒ Object
50
51
52
|
# File 'lib/astroscript/body/const_body.rb', line 50
def coerce(_other)
[0, 0] end
|
#get_body(**_args) ⇒ Object
29
30
31
|
# File 'lib/astroscript/body/const_body.rb', line 29
def get_body **_args
@lon
end
|
#respond_to_missing?(_method_name, _include_private = false) ⇒ Boolean
46
47
48
|
# File 'lib/astroscript/body/const_body.rb', line 46
def respond_to_missing?(_method_name, _include_private = false)
true
end
|