Class: TTYHue::Parser::Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/ttyhue/parser/tag.rb

Direct Known Subclasses

ColorTag, StyleTag

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ Tag

Returns a new instance of Tag.



5
6
7
8
9
# File 'lib/ttyhue/parser/tag.rb', line 5

def initialize(str)
  @str = str
  @match_data = str.match(regexp)
  return unless @match_data
end

Instance Method Details

#closingObject



15
16
17
# File 'lib/ttyhue/parser/tag.rb', line 15

def closing
  @match_data[:closing] != ""
end

#valid?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/ttyhue/parser/tag.rb', line 11

def valid?
  !!@match_data
end