class Holidays::Definition::Repository::CustomMethods

Public Class Methods

new() click to toggle source
# File lib/holidays/definition/repository/custom_methods.rb, line 5
def initialize
  @custom_methods = {}
end

Public Instance Methods

add(new_custom_methods) click to toggle source

This performs a merge that overwrites any conflicts. While this is not ideal I'm leaving it as-is since I have no evidence of any current definitions that will cause an issue.

FIXME: this should probably return an error if a method with the same ID already exists.

# File lib/holidays/definition/repository/custom_methods.rb, line 15
def add(new_custom_methods)
  raise ArgumentError if new_custom_methods.nil?
  @custom_methods.merge!(new_custom_methods)
end
find(method_id) click to toggle source
# File lib/holidays/definition/repository/custom_methods.rb, line 20
def find(method_id)
  raise ArgumentError if method_id.nil? || method_id.empty?
  @custom_methods[method_id]
end