Class: Begin::Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/begin/config.rb

Overview

Represents an expected mustache tag, as defined in the template config. Every type of tag has a key name (as inserted into the mustache context), and a human-readable label (as presented to the user).

Direct Known Subclasses

HashTag, ValueTag

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, label, array) ⇒ Tag

Returns a new instance of Tag.



40
41
42
43
44
# File 'lib/begin/config.rb', line 40

def initialize(key, label, array)
  @key = key
  @label = label
  @array = array
end

Instance Attribute Details

#arrayObject (readonly)

Returns the value of attribute array.



38
39
40
# File 'lib/begin/config.rb', line 38

def array
  @array
end

#keyObject (readonly)

Returns the value of attribute key.



36
37
38
# File 'lib/begin/config.rb', line 36

def key
  @key
end

#labelObject (readonly)

Returns the value of attribute label.



37
38
39
# File 'lib/begin/config.rb', line 37

def label
  @label
end

Class Method Details

.from_config(key, value) ⇒ Object



46
47
48
49
50
# File 'lib/begin/config.rb', line 46

def self.from_config(key, value)
  return HashTag.from_config(key, value) if value.include? 'tags'

  ValueTag.from_config(key, value)
end