Method: Simplepay::Support::Interval#initialize
- Defined in:
- lib/simplepay/support/interval.rb
#initialize(*args) ⇒ Interval
Creates an instance of the Interval. This can be called in one of several ways:
- no arguments
Creates a new interval instance with default values.
- one argument, string
Creates a new interval by parsing the given string to set both the quantity and interval. Must be formatted as: "3 day" (quantity, space, interval)
- one argument, hash
Creates a new interval and populates it with the given :quantity and :interval. Uses defaults if not given.
- two arguments
Creates a new interval with the first argument as the quantity, second argument as the interval.
Examples
All of these are equivalent:
Interval.new("3 day")
Interval.new({:quantity => 3, :interval => 'day'})
Interval.new(3, 'day')
63 64 65 |
# File 'lib/simplepay/support/interval.rb', line 63 def initialize(*args) parse_arguments(*args) end |