Class: Ephemeris::Zodiac::Interpreter
- Inherits:
-
Object
- Object
- Ephemeris::Zodiac::Interpreter
- Defined in:
- lib/ephemeris/zodiac/interpreter.rb
Instance Attribute Summary collapse
-
#sign ⇒ Object
Returns the value of attribute sign.
Instance Method Summary collapse
-
#initialize(degree) ⇒ Interpreter
constructor
A new instance of Interpreter.
Constructor Details
#initialize(degree) ⇒ Interpreter
Returns a new instance of Interpreter.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ephemeris/zodiac/interpreter.rb', line 6 def initialize( degree ) @sign = nil raise Ephemeris::Zodiac::InvalidDegree.new("#{degree} is not between 0 and 360.") unless (0...360).cover? degree signs = Ephemeris::Zodiac::PositionMatrix.constants signs.each do |sign| @sign = sign.to_s if Ephemeris::Zodiac::PositionMatrix.const_get(sign).cover?( degree ) end raise Ephemeris::Zodiac::UnprocessableEntity.new("Your request #{degree} was not found") if @sign.nil? end |
Instance Attribute Details
#sign ⇒ Object
Returns the value of attribute sign.
4 5 6 |
# File 'lib/ephemeris/zodiac/interpreter.rb', line 4 def sign @sign end |