Module: RegexpPropertyValues::Value::SharedMethods

Included in:
RegexpPropertyValues::Value
Defined in:
lib/regexp_property_values/value/shared_methods.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/regexp_property_values/value/shared_methods.rb', line 4

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



14
15
16
# File 'lib/regexp_property_values/value/shared_methods.rb', line 14

def ==(other)
  identifier == other.identifier
end

#character_setObject



32
33
34
35
# File 'lib/regexp_property_values/value/shared_methods.rb', line 32

def character_set
  require 'character_set'
  CharacterSet.from_ranges(*matched_ranges)
end

#full_nameObject



28
29
30
# File 'lib/regexp_property_values/value/shared_methods.rb', line 28

def full_name
  (original = find_original) ? original.name : raise_unknown_error
end

#hashObject



19
20
21
# File 'lib/regexp_property_values/value/shared_methods.rb', line 19

def hash
  @hash ||= identifier.hash
end

#identifierObject Also known as: to_s



23
24
25
# File 'lib/regexp_property_values/value/shared_methods.rb', line 23

def identifier
  @identifier ||= name.to_s.downcase.gsub(/[^0-9a-z=.]/, '')
end

#initialize(name) ⇒ Object



6
7
8
# File 'lib/regexp_property_values/value/shared_methods.rb', line 6

def initialize(name)
  @name = name
end

#supported_by_current_ruby?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/regexp_property_values/value/shared_methods.rb', line 10

def supported_by_current_ruby?
  !!regexp rescue false
end