Method: Puppet::Pops::Types::PAbstractTimeDataType#initialize

Defined in:
lib/puppet/pops/types/p_timespan_type.rb

#initialize(from, to = nil) ⇒ PAbstractTimeDataType

Returns a new instance of PAbstractTimeDataType.

Parameters:

  • from (AbstractTime)

    lower bound for this type. Nil or :default means unbounded

  • to (AbstractTime) (defaults to: nil)

    upper bound for this type. Nil or :default means unbounded

Raises:

  • (ArgumentError)


8
9
10
11
12
# File 'lib/puppet/pops/types/p_timespan_type.rb', line 8

def initialize(from, to = nil)
  @from = convert_arg(from, true)
  @to = convert_arg(to, false)
  raise ArgumentError, "'from' must be less or equal to 'to'. Got (#{@from}, #{@to}" unless @from <= @to
end