Class: Forkforge::CharacterDecompositionMapping::Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/forkforge/internal/character_decomposition_mapping.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ Tag

Returns a new instance of Tag.



48
49
50
51
# File 'lib/forkforge/internal/character_decomposition_mapping.rb', line 48

def initialize str
  m = "#{str}".match /^<?(#{VARIANTS.keys.join('|')})>?$/
  @tag, @sym = "<#{m[1]}>", :"#{m[1]}" if MatchData === m
end

Instance Attribute Details

#symObject (readonly)

Returns the value of attribute sym.



47
48
49
# File 'lib/forkforge/internal/character_decomposition_mapping.rb', line 47

def sym
  @sym
end

#tagObject (readonly)

Returns the value of attribute tag.



47
48
49
# File 'lib/forkforge/internal/character_decomposition_mapping.rb', line 47

def tag
  @tag
end

Class Method Details

.tag(s) ⇒ Object



55
56
57
# File 'lib/forkforge/internal/character_decomposition_mapping.rb', line 55

def self.tag s
  Tag.new(s)
end

.tag?(s) ⇒ Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/forkforge/internal/character_decomposition_mapping.rb', line 58

def self.tag? s
  self.tag(s).valid?
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/forkforge/internal/character_decomposition_mapping.rb', line 52

def valid?
  !@tag.nil? && !@sym.nil?
end