class Begin::HashTag

Represents a nested object hash tag. On encountering a hash tag, the user is prompted to enter a value for each member of the hash.

Attributes

children[R]

Public Class Methods

from_config(key, value) click to toggle source
# File lib/begin/config.rb, line 92
def self.from_config(key, value)
  array = value.include?('array') ? value['array'] : false
  label = value.include?('label') ? value['label'] : key
  children = value.include?('tags') ? from_config_hash(value) : []
  HashTag.new key, label, array, children
end
from_config_hash(config) click to toggle source
# File lib/begin/config.rb, line 83
def self.from_config_hash(config)
  return [] unless config.include?('tags') && config['tags'].is_a?(Hash)
  config['tags'].each.map do |key, value|
    raise "Invalid template. Expected value of '#{key}' to be a Hash" \
      unless value.is_a? Hash
    Tag.from_config key, value
  end
end
new(key, label, array, children) click to toggle source
Calls superclass method Begin::Tag::new
# File lib/begin/config.rb, line 78
def initialize(key, label, array, children)
  super key, label, array
  @children = children
end