Sha256: 1f89a4539bd7a78449097ba8ed66b1cc071da6737520ce29d3f53ab4074b16b4

Contents?: true

Size: 548 Bytes

Versions: 2

Compression:

Stored size: 548 Bytes

Contents

module SPV
  module Mixins
    module Element
      def element_with_vcr(element_name, *args, &block)
        element element_name, *args

        link_vcr_with_element(element_name, &block)
      end

      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
site_prism.vcr-0.3.0 lib/site_prism_vcr/mixins/element.rb
site_prism.vcr-0.2.0 lib/site_prism_vcr/mixins/element.rb