Sha256: 581adcb8372a5a5d7d4ea84416a6686ec0a991fae737e376d5370e621b2dd98e

Contents?: true

Size: 892 Bytes

Versions: 1

Compression:

Stored size: 892 Bytes

Contents

module Calrom
  module Refinement
    module CalendariumRomanum
      # Refinement used when evaluating the Day/Celebration filter expressions.
      # Allows the user (at least in simple cases) to write just `TRIDUUM` both
      # as a season and as a rank.
      module TriduumNameClashWorkaround
        refine CR::Season do
          alias_method :old_equal, :==

          def ==(other)
            if other.is_a?(CR::Rank) && self == CR::Seasons::TRIDUUM
              return CR::Ranks::TRIDUUM == other
            end

            old_equal other
          end
        end

        refine CR::Rank do
          alias_method :old_equal, :==

          def ==(other)
            if other.is_a?(CR::Season) && self == CR::Ranks::TRIDUUM
              return CR::Seasons::TRIDUUM == other
            end

            old_equal other
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
calrom-0.4.0 lib/calrom/refinement/calendarium-romanum/triduum_nameclash_workaround.rb