Class: Feriados::Rules::RuleBase

Inherits:
Object
  • Object
show all
Defined in:
lib/feriados/rules/rule_base.rb

Direct Known Subclasses

DayOfMonth, DayOfWeek, FixDate, FixWeekDay

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil) ⇒ RuleBase

Returns a new instance of RuleBase.



6
7
8
# File 'lib/feriados/rules/rule_base.rb', line 6

def initialize(name = nil)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/feriados/rules/rule_base.rb', line 4

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/feriados/rules/rule_base.rb', line 18

def ==(other)
  eql?(other)
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/feriados/rules/rule_base.rb', line 14

def eql?(other)
  hash == other.hash
end

#hashObject



10
11
12
# File 'lib/feriados/rules/rule_base.rb', line 10

def hash
  state.hash
end