module RegexpPropertyValues::Value::SharedMethods
Attributes
name[R]
Public Class Methods
new(name)
click to toggle source
# File lib/regexp_property_values/value/shared_methods.rb, line 6 def initialize(name) @name = name end
Public Instance Methods
==(other)
click to toggle source
# File lib/regexp_property_values/value/shared_methods.rb, line 14 def ==(other) identifier == other.identifier end
Also aliased as: eql?
character_set()
click to toggle source
# File lib/regexp_property_values/value/shared_methods.rb, line 32 def character_set require 'character_set' CharacterSet.from_ranges(*matched_ranges) end
full_name()
click to toggle source
# File lib/regexp_property_values/value/shared_methods.rb, line 28 def full_name (original = find_original) ? original.name : raise_unknown_error end
hash()
click to toggle source
# File lib/regexp_property_values/value/shared_methods.rb, line 19 def hash @hash ||= identifier.hash end
identifier()
click to toggle source
# File lib/regexp_property_values/value/shared_methods.rb, line 23 def identifier @identifier ||= name.to_s.downcase.gsub(/[^0-9a-z=.]/, '') end
Also aliased as: to_s
supported_by_current_ruby?()
click to toggle source
# File lib/regexp_property_values/value/shared_methods.rb, line 10 def supported_by_current_ruby? !!regexp rescue false end
Private Instance Methods
find_original()
click to toggle source
# File lib/regexp_property_values/value/shared_methods.rb, line 45 def find_original RegexpPropertyValues.all.find { |orig| orig.eql?(self) } || RegexpPropertyValues.alias_hash[self] end
raise_unknown_error()
click to toggle source
# File lib/regexp_property_values/value/shared_methods.rb, line 58 def raise_unknown_error raise Error, "Property name `#{name}` is not known in any Ruby" end
raise_unsupported_error()
click to toggle source
# File lib/regexp_property_values/value/shared_methods.rb, line 54 def raise_unsupported_error raise Error, "Property name `#{name}` is known, but not in this Ruby" end
raise_unsupported_or_unknown_error()
click to toggle source
# File lib/regexp_property_values/value/shared_methods.rb, line 50 def raise_unsupported_or_unknown_error find_original ? raise_unsupported_error : raise_unknown_error end
regexp()
click to toggle source
# File lib/regexp_property_values/value/shared_methods.rb, line 39 def regexp @regexp ||= /\p{#{identifier}}/u rescue RegexpError, SyntaxError raise_unsupported_or_unknown_error end