Class: Puppet::Pops::Types::PPatternType
Overview
Represents a subtype of String that narrows the string to those matching the patterns If specified without a pattern it is basically the same as the String type.
Constant Summary
collapse
- DEFAULT =
PPatternType.new(EMPTY_ARRAY)
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from PScalarType
#instance?
Methods inherited from PAnyType
#==, #assignable?, #callable?, #callable_args?, #check_self_recursion, #create, #generalize, #instance?, #iterable?, #iterable_type, #kind_of_callable?, #name, new_function, #new_function, #normalize, #really_instance?, #resolve, #simple_name, simple_name, #to_alias_expanded_s, #to_s
_ptype, create_ptype, register_ptypes
#_ptype
Constructor Details
Returns a new instance of PPatternType.
1580
1581
1582
|
# File 'lib/puppet/pops/types/types.rb', line 1580
def initialize(patterns)
@patterns = patterns.freeze
end
|
Instance Attribute Details
1578
1579
1580
|
# File 'lib/puppet/pops/types/types.rb', line 1578
def patterns
@patterns
end
|
Class Method Details
.register_ptype(loader, ir) ⇒ Object
1574
1575
1576
|
# File 'lib/puppet/pops/types/types.rb', line 1574
def self.register_ptype(loader, ir)
create_ptype(loader, ir, 'ScalarType', 'patterns' => PArrayType.new(PRegexpType::DEFAULT))
end
|
Instance Method Details
#accept(visitor, guard) ⇒ Object
1584
1585
1586
1587
|
# File 'lib/puppet/pops/types/types.rb', line 1584
def accept(visitor, guard)
super
@patterns.each { |p| p.accept(visitor, guard) }
end
|
#eql?(o) ⇒ Boolean
1593
1594
1595
|
# File 'lib/puppet/pops/types/types.rb', line 1593
def eql?(o)
self.class == o.class && @patterns.size == o.patterns.size && (@patterns - o.patterns).empty?
end
|
1589
1590
1591
|
# File 'lib/puppet/pops/types/types.rb', line 1589
def hash
@patterns.hash
end
|