module Zakuro::Operation::MonthDiffsParser

MonthDiffsParser 月情報(差分)解析

Public Class Methods

create(yaml_hash: {}) click to toggle source
# File lib/zakuro/operation/month/parser.rb, line 304
def self.create(yaml_hash: {})
  Diffs.new(
    month: create_month(yaml_hash: yaml_hash['month']),
    solar_term: create_solar_term(yaml_hash: yaml_hash['solar_term']),
    days: Operation::TypeParser.days(str: yaml_hash['days'])
  )
end

Private Class Methods

create_destination_solar_term(yaml_hash: {}) click to toggle source
# File lib/zakuro/operation/month/parser.rb, line 330
def self.create_destination_solar_term(yaml_hash: {})
  SolarTerm::Destination.new(
    index: Operation::TypeParser.solar_term_index(str: yaml_hash['index']),
    from: Operation::TypeParser.western_date(str: yaml_hash['from']),
    zodiac_name: Operation::TypeParser.text(str: yaml_hash['zodiac_name'])
  )
end
create_month(yaml_hash: {}) click to toggle source
# File lib/zakuro/operation/month/parser.rb, line 339
def self.create_month(yaml_hash: {})
  Month.new(
    number: create_month_number(yaml_hash: yaml_hash['number']),
    leaped: create_month_leaped(yaml_hash: yaml_hash['leaped']),
    is_many_days: create_month_day(yaml_hash: yaml_hash['days'])
  )
end
create_month_day(yaml_hash: {}) click to toggle source
# File lib/zakuro/operation/month/parser.rb, line 364
def self.create_month_day(yaml_hash: {})
  Days.new(
    calc: yaml_hash['calc'],
    actual: yaml_hash['actual']
  )
end
create_month_leaped(yaml_hash: {}) click to toggle source
# File lib/zakuro/operation/month/parser.rb, line 356
def self.create_month_leaped(yaml_hash: {})
  Leaped.new(
    calc: Operation::TypeParser.month_leaped(str: yaml_hash['calc']),
    actual: Operation::TypeParser.month_leaped(str: yaml_hash['actual'])
  )
end
create_month_number(yaml_hash: {}) click to toggle source
# File lib/zakuro/operation/month/parser.rb, line 348
def self.create_month_number(yaml_hash: {})
  Number.new(
    calc: Operation::TypeParser.month_number(str: yaml_hash['calc']),
    actual: Operation::TypeParser.month_number(str: yaml_hash['actual'])
  )
end
create_solar_term(yaml_hash: {}) click to toggle source
# File lib/zakuro/operation/month/parser.rb, line 312
def self.create_solar_term(yaml_hash: {})
  SolarTerm::Direction.new(
    source: create_source_solar_term(yaml_hash: yaml_hash['calc']),
    destination: create_destination_solar_term(yaml_hash: yaml_hash['actual']),
    days: Operation::TypeParser.days(str: yaml_hash['days'])
  )
end
create_source_solar_term(yaml_hash: {}) click to toggle source
# File lib/zakuro/operation/month/parser.rb, line 321
def self.create_source_solar_term(yaml_hash: {})
  SolarTerm::Source.new(
    index: Operation::TypeParser.solar_term_index(str: yaml_hash['index']),
    to: Operation::TypeParser.western_date(str: yaml_hash['to']),
    zodiac_name: Operation::TypeParser.text(str: yaml_hash['zodiac_name'])
  )
end