Class: AstroInsight::Models::MatchInput
- Inherits:
-
Object
- Object
- AstroInsight::Models::MatchInput
- Defined in:
- lib/astroinsight/models/match_input.rb
Instance Attribute Summary collapse
-
#female ⇒ Object
Returns the value of attribute female.
-
#male ⇒ Object
Returns the value of attribute male.
Instance Method Summary collapse
-
#initialize(male:, female:) ⇒ MatchInput
constructor
A new instance of MatchInput.
- #to_h ⇒ Object
- #to_json(*_args) ⇒ Object
Constructor Details
#initialize(male:, female:) ⇒ MatchInput
Returns a new instance of MatchInput.
10 11 12 13 |
# File 'lib/astroinsight/models/match_input.rb', line 10 def initialize(male:, female:) @male = male.is_a?(BirthDetails) ? male : BirthDetails.new(**male.transform_keys(&:to_sym)) @female = female.is_a?(BirthDetails) ? female : BirthDetails.new(**female.transform_keys(&:to_sym)) end |
Instance Attribute Details
#female ⇒ Object
Returns the value of attribute female.
8 9 10 |
# File 'lib/astroinsight/models/match_input.rb', line 8 def female @female end |
#male ⇒ Object
Returns the value of attribute male.
8 9 10 |
# File 'lib/astroinsight/models/match_input.rb', line 8 def male @male end |
Instance Method Details
#to_h ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/astroinsight/models/match_input.rb', line 15 def to_h m = @male.to_h f = @female.to_h { m_day: m[:day], m_month: m[:month], m_year: m[:year], m_hour: m[:hour], m_min: m[:min], m_sec: m[:sec], m_tzone: m[:tzone], m_lat: m[:lat], m_lon: m[:lon], f_day: f[:day], f_month: f[:month], f_year: f[:year], f_hour: f[:hour], f_min: f[:min], f_sec: f[:sec], f_tzone: f[:tzone], f_lat: f[:lat], f_lon: f[:lon] } end |
#to_json(*_args) ⇒ Object
41 42 43 |
# File 'lib/astroinsight/models/match_input.rb', line 41 def to_json(*_args) to_h.to_json end |