Module: SPV::Mixins::Element

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

Instance Method Summary collapse

Instance Method Details

#element_with_vcr(element_name, *args, &block) ⇒ Object



4
5
6
7
8
# File 'lib/site_prism_vcr/mixins/element.rb', line 4

def element_with_vcr(element_name, *args, &block)
  element element_name, *args

  link_vcr_with_element(element_name, &block)
end


10
11
12
13
14
15
16
17
18
19
20
# File 'lib/site_prism_vcr/mixins/element.rb', line 10

def link_vcr_with_element(element_name, &block)
  origin_element_name = "origin_#{element_name}"

  alias_method origin_element_name, element_name

  define_method element_name.to_s do
    elem = public_send(origin_element_name)

    SPV::Element.new(elem, self, &block)
  end
end