Class: Generamba::TemplateDeclaration

Inherits:
Object
  • Object
show all
Defined in:
lib/generamba/template/processor/template_declaration.rb

Overview

Describes a Generamba template declaration model

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template_hash) ⇒ TemplateDeclaration

Returns a new instance of TemplateDeclaration.



20
21
22
23
24
25
26
27
28
29
# File 'lib/generamba/template/processor/template_declaration.rb', line 20

def initialize(template_hash)
  @name = template_hash[TEMPLATE_DECLARATION_NAME_KEY]
  @local = template_hash[TEMPLATE_DECLARATION_LOCAL_KEY]
  @git = template_hash[TEMPLATE_DECLARATION_GIT_KEY]
  @branch = template_hash[TEMPLATE_DECLARATION_BRANCH_KEY]

  @type = TemplateDeclarationType::LOCAL_TEMPLATE if @local
  @type = TemplateDeclarationType::REMOTE_TEMPLATE if @git
  @type = TemplateDeclarationType::CATALOG_TEMPLATE if @git == nil && @local == nil
end

Instance Attribute Details

#branchObject (readonly)

Returns the value of attribute branch.



18
19
20
# File 'lib/generamba/template/processor/template_declaration.rb', line 18

def branch
  @branch
end

#gitObject (readonly)

Returns the value of attribute git.



18
19
20
# File 'lib/generamba/template/processor/template_declaration.rb', line 18

def git
  @git
end

#localObject (readonly)

Returns the value of attribute local.



18
19
20
# File 'lib/generamba/template/processor/template_declaration.rb', line 18

def local
  @local
end

#nameObject (readonly)

Returns the value of attribute name.



18
19
20
# File 'lib/generamba/template/processor/template_declaration.rb', line 18

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



18
19
20
# File 'lib/generamba/template/processor/template_declaration.rb', line 18

def type
  @type
end

Instance Method Details

#install(strategy) ⇒ Object



31
32
33
# File 'lib/generamba/template/processor/template_declaration.rb', line 31

def install(strategy)
  strategy.install_template(self)
end