Class: Bashly::RenderContext
- Inherits:
-
Object
- Object
- Bashly::RenderContext
- Includes:
- Colsole
- Defined in:
- lib/bashly/render_context.rb
Instance Attribute Summary collapse
- #config ⇒ Object
-
#show ⇒ Object
readonly
Returns the value of attribute show.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #command ⇒ Object
-
#initialize(source:, target:, show: nil) ⇒ RenderContext
constructor
A new instance of RenderContext.
- #save(filename, content) ⇒ Object
Constructor Details
#initialize(source:, target:, show: nil) ⇒ RenderContext
Returns a new instance of RenderContext.
11 12 13 14 15 |
# File 'lib/bashly/render_context.rb', line 11 def initialize(source:, target:, show: nil) @source = source @target = target @show = show end |
Instance Attribute Details
#config ⇒ Object
17 18 19 |
# File 'lib/bashly/render_context.rb', line 17 def config @config ||= Config.new Settings.config_path end |
#show ⇒ Object (readonly)
Returns the value of attribute show.
8 9 10 |
# File 'lib/bashly/render_context.rb', line 8 def show @show end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
8 9 10 |
# File 'lib/bashly/render_context.rb', line 8 def source @source end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
8 9 10 |
# File 'lib/bashly/render_context.rb', line 8 def target @target end |
Instance Method Details
#command ⇒ Object
21 22 23 |
# File 'lib/bashly/render_context.rb', line 21 def command @command ||= Script::Command.new config end |
#save(filename, content) ⇒ Object
25 26 27 28 |
# File 'lib/bashly/render_context.rb', line 25 def save(filename, content) File.deep_write filename, content say "g`saved` #{filename}" end |