Class: Jekyll::Premonition::Attributes::Stacker

Inherits:
Object
  • Object
show all
Defined in:
lib/premonition/attributes/stacker.rb

Overview

Instances of this class are pushed onto the parser stack upon parsing of block attributes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ Stacker

Initialize a new Stacker

type - The stacker type



20
21
22
23
24
# File 'lib/premonition/attributes/stacker.rb', line 20

def initialize(type)
  @value = nil
  @type = type
  @meta = {}
end

Instance Attribute Details

#metaObject

Get and set meta attributes for stacker. Used for setting value mode.



15
16
17
# File 'lib/premonition/attributes/stacker.rb', line 15

def meta
  @meta
end

#typeObject (readonly)

Get the stacker type. 0 = outside block, 1 = in_between, 2 = key, 3 = value



13
14
15
# File 'lib/premonition/attributes/stacker.rb', line 13

def type
  @type
end

#valueObject (readonly)

Get the string value from the stacker



11
12
13
# File 'lib/premonition/attributes/stacker.rb', line 11

def value
  @value
end

Instance Method Details

#append(char) ⇒ Object

Append a char to the stacker value



27
28
29
# File 'lib/premonition/attributes/stacker.rb', line 27

def append(char)
  @value = @value.nil? ? char : "#{@value}#{char}"
end