Module: RegexpPropertyValues::Value::SharedMethods
- Included in:
- RegexpPropertyValues::Value
- Defined in:
- lib/regexp_property_values/value/shared_methods.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #character_set ⇒ Object
- #full_name ⇒ Object
- #hash ⇒ Object
- #identifier ⇒ Object (also: #to_s)
- #initialize(name) ⇒ Object
- #supported_by_current_ruby? ⇒ Boolean
Instance Attribute Details
#name ⇒ Object (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_set ⇒ Object
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_name ⇒ Object
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 |
#hash ⇒ Object
19 20 21 |
# File 'lib/regexp_property_values/value/shared_methods.rb', line 19 def hash @hash ||= identifier.hash end |
#identifier ⇒ Object 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
10 11 12 |
# File 'lib/regexp_property_values/value/shared_methods.rb', line 10 def supported_by_current_ruby? !!regexp rescue false end |