Class: StaticShellTemplates::Include
- Inherits:
-
Object
- Object
- StaticShellTemplates::Include
- Defined in:
- lib/static_shell_templates.rb
Instance Attribute Summary collapse
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#template ⇒ Object
readonly
Returns the value of attribute template.
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(template, logger = Logger.new(STDOUT)) ⇒ Include
constructor
A new instance of Include.
- #output ⇒ Object
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
#header ⇒ Object (readonly)
Returns the value of attribute header.
34 35 36 |
# File 'lib/static_shell_templates.rb', line 34 def header @header end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
34 35 36 |
# File 'lib/static_shell_templates.rb', line 34 def source @source end |
#template ⇒ Object (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
#content ⇒ Object
45 46 47 48 49 |
# File 'lib/static_shell_templates.rb', line 45 def content response = fetch @source response.body end |
#output ⇒ Object
67 68 69 70 71 |
# File 'lib/static_shell_templates.rb', line 67 def output %(#{@header} #{content} #template:end) end |