Skip to content

Commit

Permalink
Style ScopeVariantToHub
Browse files Browse the repository at this point in the history
  • Loading branch information
mkllnk committed Aug 9, 2018
1 parent 27ddb71 commit 289d0b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ Layout/EmptyLines:
- 'lib/open_food_network/reports/bulk_coop_report.rb'
- 'lib/open_food_network/sales_tax_report.rb'
- 'lib/open_food_network/scope_product_to_hub.rb'
- 'lib/open_food_network/scope_variant_to_hub.rb'
- 'lib/open_food_network/xero_invoices_report.rb'
- 'lib/spree/core/controller_helpers/order_decorator.rb'
- 'lib/tasks/cache.rake'
Expand Down Expand Up @@ -648,7 +647,6 @@ Layout/SpaceAroundEqualsInParameterDefault:
- 'lib/open_food_network/enterprise_issue_validator.rb'
- 'lib/open_food_network/order_cycle_form_applicator.rb'
- 'lib/open_food_network/permissions.rb'
- 'lib/open_food_network/scope_variant_to_hub.rb'
- 'lib/open_food_network/tag_rule_applicator.rb'
- 'lib/open_food_network/xero_invoices_report.rb'
- 'lib/spree/money_decorator.rb'
Expand Down
7 changes: 3 additions & 4 deletions lib/open_food_network/scope_variant_to_hub.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module OpenFoodNetwork
class ScopeVariantToHub
def initialize(hub, variant_overrides=nil)
def initialize(hub, variant_overrides = nil)
@hub = hub
@variant_overrides = variant_overrides || VariantOverride.indexed(@hub)
end
Expand All @@ -11,7 +11,6 @@ def scope(variant)
variant.instance_variable_set :@variant_override, @variant_overrides[variant]
end


module ScopeVariantToHub
def price
@variant_override.andand.price || super
Expand Down Expand Up @@ -39,15 +38,15 @@ def on_demand
end
end

def decrement!(attribute, by=1)
def decrement!(attribute, by = 1)
if attribute == :count_on_hand && @variant_override.andand.stock_overridden?
@variant_override.decrement_stock! by
else
super
end
end

def increment!(attribute, by=1)
def increment!(attribute, by = 1)
if attribute == :count_on_hand && @variant_override.andand.stock_overridden?
@variant_override.increment_stock! by
else
Expand Down

0 comments on commit 289d0b9

Please sign in to comment.