Class: ShopifyCLI::Theme::Syncer::StandardReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/shopify_cli/theme/syncer/standard_reporter.rb

Overview

ShopifyCLI::Theme::Syncer::StdReporter allows disabling/enabling messages reported in the standard error output (ShopifyCLI::Context#puts).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ctx) ⇒ StandardReporter

Returns a new instance of StandardReporter.



13
14
15
16
# File 'lib/shopify_cli/theme/syncer/standard_reporter.rb', line 13

def initialize(ctx)
  @enabled = true
  @ctx = ctx
end

Instance Attribute Details

#ctxObject (readonly)

Returns the value of attribute ctx.



11
12
13
# File 'lib/shopify_cli/theme/syncer/standard_reporter.rb', line 11

def ctx
  @ctx
end

Instance Method Details

#disable!Object



18
19
20
# File 'lib/shopify_cli/theme/syncer/standard_reporter.rb', line 18

def disable!
  @enabled = false
end

#enable!Object



22
23
24
# File 'lib/shopify_cli/theme/syncer/standard_reporter.rb', line 22

def enable!
  @enabled = true
end

#report(message) ⇒ Object



26
27
28
# File 'lib/shopify_cli/theme/syncer/standard_reporter.rb', line 26

def report(message)
  ctx.error(message) if @enabled
end