Class: MiniCSS::CSS::Token
- Inherits:
-
Object
- Object
- MiniCSS::CSS::Token
- Defined in:
- lib/minicss/css/token.rb
Constant Summary collapse
- EOF =
Token.new(:eof, nil, nil)
Instance Attribute Summary collapse
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
- #literal ⇒ Object
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#pos_end ⇒ Object
readonly
Returns the value of attribute pos_end.
-
#pos_start ⇒ Object
readonly
Returns the value of attribute pos_start.
Instance Method Summary collapse
- #eof? ⇒ Boolean
-
#initialize(kind, pos_start, pos_end, **opts) ⇒ Token
constructor
A new instance of Token.
Constructor Details
#initialize(kind, pos_start, pos_end, **opts) ⇒ Token
Returns a new instance of Token.
9 10 11 12 13 14 15 |
# File 'lib/minicss/css/token.rb', line 9 def initialize(kind, pos_start, pos_end, **opts) @kind = kind @pos_start = pos_start @pos_end = pos_end @literal = opts.delete(:literal) @opts = opts.empty? ? nil : opts end |
Instance Attribute Details
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
6 7 8 |
# File 'lib/minicss/css/token.rb', line 6 def kind @kind end |
#literal ⇒ Object
17 18 19 20 21 |
# File 'lib/minicss/css/token.rb', line 17 def literal return " " if kind == :whitespace @literal end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
6 7 8 |
# File 'lib/minicss/css/token.rb', line 6 def opts @opts end |
#pos_end ⇒ Object (readonly)
Returns the value of attribute pos_end.
6 7 8 |
# File 'lib/minicss/css/token.rb', line 6 def pos_end @pos_end end |
#pos_start ⇒ Object (readonly)
Returns the value of attribute pos_start.
6 7 8 |
# File 'lib/minicss/css/token.rb', line 6 def pos_start @pos_start end |
Instance Method Details
#eof? ⇒ Boolean
23 |
# File 'lib/minicss/css/token.rb', line 23 def eof? = @kind == :eof |