Sha256: c3af213fadfecd82f52439c3515839a399b66d4a2f10518b82f3a97b063cf2f6

Contents?: true

Size: 1.38 KB

Versions: 7

Compression:

Stored size: 1.38 KB

Contents

# frozen_string_literal: true

require_relative './month/parser'

# :nodoc:
module Zakuro
  #
  # Operation 運用
  #
  module Operation
    #
    # 変更履歴(月)
    #
    MONTH_HISTORIES = MonthParser.run(filepath: File.expand_path(
      './yaml/month.yaml',
      __dir__
    ))

    class << self
      #
      # 変更履歴(月)を返す
      #
      # @return [Array<MonthHistory>] 変更履歴
      #
      def month_histories
        MONTH_HISTORIES
      end

      # :reek:ControlParameter

      #
      # 変更履歴を特定する
      #
      # @param [Western::Calendar] western_date 月初日の西暦日
      #
      # @return [Operation::MonthHistory] 変更履歴
      #
      def specify_history(western_date:)
        month_histroies = month_histories

        month_histroies.each do |history|
          return history if western_date == history.western_date
        end

        Operation::MonthHistory.new
      end

      # :reek:ControlParameter

      #
      # 変更履歴を特定する
      #
      # @param [Western::Calendar] id 変更履歴ID
      #
      # @return [Operation::MonthHistory] 変更履歴
      #
      def specify_history_by_id(id:)
        month_histroies = month_histories

        month_histroies.each do |history|
          return history if id == history.id
        end

        Operation::MonthHistory.new
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
zakuro-1.0.0 lib/zakuro/operation/operation.rb
zakuro-0.9.4 lib/zakuro/operation/operation.rb
zakuro-0.9.3 lib/zakuro/operation/operation.rb
zakuro-0.9.2 lib/zakuro/operation/operation.rb
zakuro-0.9.1 lib/zakuro/operation/operation.rb
zakuro-0.9.0 lib/zakuro/operation/operation.rb
zakuro-0.8.0 lib/zakuro/operation/operation.rb