Class: Shopify::DefaultVariant::Object

Inherits:
Object
  • Object
show all
Defined in:
lib/shopify/default_variant.rb

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ Object

Returns a new instance of Object.



9
10
11
# File 'lib/shopify/default_variant.rb', line 9

def initialize(object)
  @object = object
end

Instance Method Details

#match?Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
21
# File 'lib/shopify/default_variant.rb', line 13

def match?
  # TODO: arity???
  if @object.respond_to?(:variants)
    variants = @object.variants
    return variants.size == 1 && default_variant?(variants[0])
  end

  default_variant?(@object)
end