Module: RSpec::Resources::Util
- Defined in:
- lib/rspec/resources/util.rb
Class Method Summary collapse
- .access_by_path(doc, path) ⇒ Object
- .document_format_hash(metadata = nil) ⇒ Object
- .nested_resource?(metadata) ⇒ Boolean
Class Method Details
.access_by_path(doc, path) ⇒ Object
10 11 12 13 |
# File 'lib/rspec/resources/util.rb', line 10 def self.access_by_path(doc, path) path.split('.').each { |p| doc = doc[p] } if path.present? doc end |
.document_format_hash(metadata = nil) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/rspec/resources/util.rb', line 15 def self.document_format_hash( = nil) doc_format = ( || RSpec.current_example.)[:document_format] return DOCUMENT_FORMATS[doc_format] if doc_format.is_a?(Symbol) || doc_format.is_a?(String) doc_format.respond_to?(:with_indifferent_access) ? doc_format.with_indifferent_access : doc_format end |
.nested_resource?(metadata) ⇒ Boolean
6 7 8 |
# File 'lib/rspec/resources/util.rb', line 6 def self.nested_resource?() [:base_path] =~ /:\w+/ end |