Class: Puppet::Pops::Types::PRegexpType

Inherits:
PScalarType show all
Defined in:
lib/puppet/pops/types/types.rb

Constant Summary collapse

DEFAULT =
PRegexpType.new(nil)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from PScalarType

#instance?

Methods inherited from PAnyType

#==, #accept, #assignable?, #callable?, #callable_args?, #generalize, #instance?, #iterable?, #iterable_type, #kind_of_callable?, #normalize, #simple_name, #to_alias_expanded_s, #to_s

Methods included from Visitable

#accept

Constructor Details

#initialize(pattern) ⇒ PRegexpType

Returns a new instance of PRegexpType.



1042
1043
1044
# File 'lib/puppet/pops/types/types.rb', line 1042

def initialize(pattern)
  @pattern = pattern
end

Instance Attribute Details

#patternObject (readonly)



1040
1041
1042
# File 'lib/puppet/pops/types/types.rb', line 1040

def pattern
  @pattern
end

Instance Method Details

#eql?(o) ⇒ Boolean

Returns:

  • (Boolean)


1054
1055
1056
# File 'lib/puppet/pops/types/types.rb', line 1054

def eql?(o)
  self.class == o.class && @pattern == o.pattern
end

#hashObject



1050
1051
1052
# File 'lib/puppet/pops/types/types.rb', line 1050

def hash
  @pattern.hash
end

#regexpObject



1046
1047
1048
# File 'lib/puppet/pops/types/types.rb', line 1046

def regexp
  @regexp ||= Regexp.new(@pattern || '')
end