Class: StaticShellTemplates::Include

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template, logger = Logger.new(STDOUT)) ⇒ Include

Returns a new instance of Include.



36
37
38
39
40
41
42
43
# File 'lib/static_shell_templates.rb', line 36

def initialize(template, logger = Logger.new(STDOUT))
  @template = template
  @header = template
  @logger = logger
  # @logger.debug template
  source_match = template.match(/source: (?<source>.*)/)
  @source = URI source_match['source']
end

Instance Attribute Details

#headerObject (readonly)

Returns the value of attribute header.



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

def header
  @header
end

#sourceObject (readonly)

Returns the value of attribute source.



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

def source
  @source
end

#templateObject (readonly)

Returns the value of attribute template.



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

def template
  @template
end

Instance Method Details

#contentObject



45
46
47
48
49
# File 'lib/static_shell_templates.rb', line 45

def content
  response = fetch @source

  response.body
end

#outputObject



67
68
69
70
71
# File 'lib/static_shell_templates.rb', line 67

def output
  %(#{@header}
#{content}
#template:end)
end