Class: BV::Angle
- Inherits:
-
Object
- Object
- BV::Angle
- Defined in:
- lib/bivector.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #ang_value ⇒ Object
-
#initialize(value, model = :rad) ⇒ Angle
constructor
A new instance of Angle.
- #rad_value ⇒ Object
- #switch_model ⇒ Object
- #tan ⇒ Object
- #to_s ⇒ Object
- #values_in(style = :rad) ⇒ Object
Constructor Details
#initialize(value, model = :rad) ⇒ Angle
Returns a new instance of Angle.
95 96 97 98 |
# File 'lib/bivector.rb', line 95 def initialize(value, model = :rad) @value = value @model = model end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
93 94 95 |
# File 'lib/bivector.rb', line 93 def value @value end |
Instance Method Details
#ang_value ⇒ Object
115 116 117 |
# File 'lib/bivector.rb', line 115 def ang_value model == :ang ? value : value * 180 / Math::PI end |
#rad_value ⇒ Object
111 112 113 |
# File 'lib/bivector.rb', line 111 def rad_value model == :rad ? value : value * Math::PI / 180 end |
#switch_model ⇒ Object
104 105 106 107 108 109 |
# File 'lib/bivector.rb', line 104 def switch_model case model when :ang then rad_value when :rad then ang_value end end |
#tan ⇒ Object
123 124 125 |
# File 'lib/bivector.rb', line 123 def tan Math.tan(self.rad_value) end |
#to_s ⇒ Object
100 101 102 |
# File 'lib/bivector.rb', line 100 def to_s value end |
#values_in(style = :rad) ⇒ Object
119 120 121 |
# File 'lib/bivector.rb', line 119 def values_in(style = :rad) style == model ? value : switch_model end |