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

#assignable?, #callable?, #callable_args?, #enumerable?, #generalize, #instance?, #kind_of_callable?, #simple_name, #to_s

Methods included from Visitable

#accept

Constructor Details

#initialize(pattern) ⇒ PRegexpType

Returns a new instance of PRegexpType.



696
697
698
# File 'lib/puppet/pops/types/types.rb', line 696

def initialize(pattern)
  @pattern = pattern
end

Instance Attribute Details

#patternObject (readonly)



694
695
696
# File 'lib/puppet/pops/types/types.rb', line 694

def pattern
  @pattern
end

Instance Method Details

#==(o) ⇒ Object



708
709
710
# File 'lib/puppet/pops/types/types.rb', line 708

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

#hashObject



704
705
706
# File 'lib/puppet/pops/types/types.rb', line 704

def hash
  @pattern.hash
end

#regexpObject



700
701
702
# File 'lib/puppet/pops/types/types.rb', line 700

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