Class: Puppet::Pops::Types::PFloatType
- Inherits:
-
PNumericType
- Object
- TypedModelObject
- PAnyType
- PScalarType
- PNumericType
- Puppet::Pops::Types::PFloatType
- Defined in:
- lib/puppet/pops/types/types.rb
Constant Summary collapse
- DEFAULT =
PFloatType.new(-Float::INFINITY)
Instance Method Summary collapse
- #generalize ⇒ Object
- #instance?(o) ⇒ Boolean
-
#merge(o) ⇒ PFloatType?
Concatenates this range with another range provided that the ranges intersect.
Methods inherited from PNumericType
#eql?, #from, #hash, #initialize, #intersect?, #numeric_from, #numeric_to, #to, #unbounded?
Methods inherited from PAnyType
#==, #accept, #assignable?, #callable?, #callable_args?, #eql?, #hash, #iterable?, #iterable_type, #kind_of_callable?, #normalize, #simple_name, #to_alias_expanded_s, #to_s
Methods included from Visitable
Constructor Details
This class inherits a constructor from Puppet::Pops::Types::PNumericType
Instance Method Details
#generalize ⇒ Object
751 752 753 |
# File 'lib/puppet/pops/types/types.rb', line 751 def generalize DEFAULT end |
#instance?(o) ⇒ Boolean
755 756 757 |
# File 'lib/puppet/pops/types/types.rb', line 755 def instance?(o) o.is_a?(Float) && o >= numeric_from && o <= numeric_to end |
#merge(o) ⇒ PFloatType?
Concatenates this range with another range provided that the ranges intersect. When that’s not the case, this method will return ‘nil`
765 766 767 768 769 770 771 772 773 |
# File 'lib/puppet/pops/types/types.rb', line 765 def merge(o) if intersect?(o) min = @from <= o.from ? @from : o.from max = @to >= o.to ? @to : o.to PFloatType.new(min, max) else nil end end |