fix(timespan): add correct calls to units from argument error

This commit is contained in:
Luis Castro 2019-08-02 11:22:02 +02:00
parent 3965ba59f9
commit 0a9b944526
No known key found for this signature in database
GPG key ID: 0A8F33D4C4E27639

View file

@ -29,7 +29,7 @@ Timespan = Struct.new(:interval, :time_unit) do
# timespan(1, 'minute') -> 60
# timespan(1, 'month') -> 2592000
def self.create(interval, time_unit)
raise(ArgumentError, "time_unit must be one of: #{Units}") unless Units.include?(time_unit)
raise(ArgumentError, "time_unit must be one of: #{self::Units}") unless self::Units.include?(time_unit)
interval.send(time_unit.to_sym)
end