Module: SPV::Mixins::Page::ClassMethods

Defined in:
lib/site_prism_vcr/mixins/page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#vcr_adjusterObject (readonly)

Returns the value of attribute vcr_adjuster.



13
14
15
# File 'lib/site_prism_vcr/mixins/page.rb', line 13

def vcr_adjuster
  @vcr_adjuster
end

#vcr_child_adjustersObject (readonly)

Returns the value of attribute vcr_child_adjusters.



13
14
15
# File 'lib/site_prism_vcr/mixins/page.rb', line 13

def vcr_child_adjusters
  @vcr_child_adjusters
end

Instance Method Details

#adjust_parent_vcr_options(&block) ⇒ Object

Raises:

  • (ArgumentError)


27
28
29
30
31
32
33
# File 'lib/site_prism_vcr/mixins/page.rb', line 27

def adjust_parent_vcr_options(&block)
  raise ArgumentError.new(
    'There is not any Vcr options defined for the parent class'
  ) unless self.vcr_adjuster

  self.vcr_child_adjusters << block
end

#inherited(subclass) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/site_prism_vcr/mixins/page.rb', line 15

def inherited(subclass)
  # This code is required to allow subpages to inherit
  # a defined adjuster block. Otherwise, that block should be
  # duplicated in a subpage as well.
  subclass.instance_variable_set(:@vcr_adjuster,        @vcr_adjuster)
  subclass.instance_variable_set(:@vcr_child_adjusters, @vcr_child_adjusters.dup)
end

#vcr_options_for_load(&block) ⇒ Object



23
24
25
# File 'lib/site_prism_vcr/mixins/page.rb', line 23

def vcr_options_for_load(&block)
  @vcr_adjuster = block
end