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, #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.
1507
1508
1509
1510
1511
1512
1513
1514
|
# File 'lib/puppet/pops/types/types.rb', line 1507
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
1505
1506
1507
|
# File 'lib/puppet/pops/types/types.rb', line 1505
def pattern
@pattern
end
|
Class Method Details
.register_ptype(loader, ir) ⇒ Object
Instance Method Details
#eql?(o) ⇒ Boolean
1524
1525
1526
|
# File 'lib/puppet/pops/types/types.rb', line 1524
def eql?(o)
self.class == o.class && @pattern == o.pattern
end
|
1520
1521
1522
|
# File 'lib/puppet/pops/types/types.rb', line 1520
def hash
@pattern.hash
end
|
1516
1517
1518
|
# File 'lib/puppet/pops/types/types.rb', line 1516
def regexp
@regexp ||= Regexp.new(@pattern || '')
end
|