Class: Bashly::RenderContext

Inherits:
Object
  • Object
show all
Includes:
Colsole
Defined in:
lib/bashly/render_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#configObject



17
18
19
# File 'lib/bashly/render_context.rb', line 17

def config
  @config ||= Config.new Settings.config_path
end

#showObject (readonly)

Returns the value of attribute show.



8
9
10
# File 'lib/bashly/render_context.rb', line 8

def show
  @show
end

#sourceObject (readonly)

Returns the value of attribute source.



8
9
10
# File 'lib/bashly/render_context.rb', line 8

def source
  @source
end

#targetObject (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

#commandObject



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