Sha256: b7daecb5e20b79b993fc3ba8989d3582e8ae1d1a7937c294a9cceef9d2e32aef
Contents?: true
Size: 636 Bytes
Versions: 1
Compression:
Stored size: 636 Bytes
Contents
# frozen_string_literal: true module RSpec module Its # @api private # Handles turning subject into an expectation target module Subject def for(attribute, subject) if Array === attribute if Hash === subject attribute.inject(subject) { |inner, attr| inner[attr] } else subject[*attribute] end else attribute_chain = attribute.to_s.split('.') attribute_chain.inject(subject) do |inner_subject, attr| inner_subject.public_send(attr) end end end module_function :for end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rspec-its-2.0.0 | lib/rspec/its/subject.rb |