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.



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

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

Instance Attribute Details

#arrayObject (readonly)

Returns the value of attribute array.



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

def array
  @array
end

#keyObject (readonly)

Returns the value of attribute key.



34
35
36
# File 'lib/begin/config.rb', line 34

def key
  @key
end

#labelObject (readonly)

Returns the value of attribute label.



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

def label
  @label
end

Class Method Details

.from_config(key, value) ⇒ Object



44
45
46
47
# File 'lib/begin/config.rb', line 44

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