Class: Puppet::Pops::Types::PRegexpType
Constant Summary
collapse
- DEFAULT =
PRegexpType.new(nil)
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from PScalarType
#instance?
Methods inherited from PAnyType
#==, #accept, #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
Methods included from Visitable
#accept
#_ptype
Constructor Details
#initialize(pattern) ⇒ PRegexpType
Returns a new instance of PRegexpType.
1536
1537
1538
1539
1540
1541
1542
1543
|
# File 'lib/puppet/pops/types/types.rb', line 1536
def initialize(pattern)
if pattern.is_a?(Regexp)
@regexp = pattern
@pattern = pattern.options == 0 ? pattern.source : pattern.to_s
else
@pattern = pattern
end
end
|
Instance Attribute Details
1534
1535
1536
|
# File 'lib/puppet/pops/types/types.rb', line 1534
def pattern
@pattern
end
|
Class Method Details
.register_ptype(loader, ir) ⇒ Object
Instance Method Details
#eql?(o) ⇒ Boolean
1553
1554
1555
|
# File 'lib/puppet/pops/types/types.rb', line 1553
def eql?(o)
self.class == o.class && @pattern == o.pattern
end
|
1549
1550
1551
|
# File 'lib/puppet/pops/types/types.rb', line 1549
def hash
@pattern.hash
end
|
1545
1546
1547
|
# File 'lib/puppet/pops/types/types.rb', line 1545
def regexp
@regexp ||= Regexp.new(@pattern || '')
end
|