Class: I18nFlow::CLI::SearchCommand::DefaultRenderer

Inherits:
Object
  • Object
show all
Includes:
Color
Defined in:
lib/i18n_flow/cli/search_command/default_renderer.rb

Constant Summary collapse

FILE =
__dir__ + '/default.erb'

Constants included from Color

Color::COLORS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Color

#color

Constructor Details

#initialize(results, color: true) ⇒ DefaultRenderer

Returns a new instance of DefaultRenderer.



13
14
15
16
# File 'lib/i18n_flow/cli/search_command/default_renderer.rb', line 13

def initialize(results, color: true)
  @results = results
  @color_enabled = !!color
end

Instance Attribute Details

#resultsObject (readonly)

Returns the value of attribute results.



11
12
13
# File 'lib/i18n_flow/cli/search_command/default_renderer.rb', line 11

def results
  @results
end

Instance Method Details

#color_enabled?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/i18n_flow/cli/search_command/default_renderer.rb', line 22

def color_enabled?
  @color_enabled
end

#renderObject



18
19
20
# File 'lib/i18n_flow/cli/search_command/default_renderer.rb', line 18

def render
  with_color(erb.result(binding))
end