Class: ShopifyCLI::Theme::Syncer::Operation
- Inherits:
-
Object
- Object
- ShopifyCLI::Theme::Syncer::Operation
- Defined in:
- lib/shopify_cli/theme/syncer/operation.rb
Constant Summary collapse
- COLOR_BY_STATUS =
{ error: :red, synced: :green, warning: :yellow, fixed: :cyan, }
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#method ⇒ Object
Returns the value of attribute method.
Instance Method Summary collapse
- #as_error_message ⇒ Object
- #as_fix_message ⇒ Object
- #as_synced_message(color: :green) ⇒ Object
- #file_path ⇒ Object
-
#initialize(ctx, method, file) ⇒ Operation
constructor
A new instance of Operation.
- #to_s ⇒ Object
Constructor Details
#initialize(ctx, method, file) ⇒ Operation
Returns a new instance of Operation.
16 17 18 19 20 |
# File 'lib/shopify_cli/theme/syncer/operation.rb', line 16 def initialize(ctx, method, file) @ctx = ctx @method = method @file = file end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
7 8 9 |
# File 'lib/shopify_cli/theme/syncer/operation.rb', line 7 def file @file end |
#method ⇒ Object
Returns the value of attribute method.
7 8 9 |
# File 'lib/shopify_cli/theme/syncer/operation.rb', line 7 def method @method end |
Instance Method Details
#as_error_message ⇒ Object
26 27 28 |
# File 'lib/shopify_cli/theme/syncer/operation.rb', line 26 def (status: :error) end |
#as_fix_message ⇒ Object
34 35 36 |
# File 'lib/shopify_cli/theme/syncer/operation.rb', line 34 def (status: :fixed) end |
#as_synced_message(color: :green) ⇒ Object
30 31 32 |
# File 'lib/shopify_cli/theme/syncer/operation.rb', line 30 def (color: :green) (status: :synced, color: color) end |
#file_path ⇒ Object
38 39 40 |
# File 'lib/shopify_cli/theme/syncer/operation.rb', line 38 def file_path file&.relative_path end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/shopify_cli/theme/syncer/operation.rb', line 22 def to_s "#{method} #{file_path}" end |