Sha256: c54c82a3b1a99844cd55b574e00f1f7c69affbc06113e5d2cf983e0d933bdc2f
Contents?: true
Size: 855 Bytes
Versions: 38
Compression:
Stored size: 855 Bytes
Contents
module Picky module API module Source def extract_source thing, options = {} if thing.respond_to?(:each) || thing.respond_to?(:call) thing else return if options[:nil_ok] if respond_to? :name if @index location = " #{@index.name}:#{name}" else location = " #{name}" end else location = '' end raise ArgumentError.new(<<-ERROR) The#{location} source should respond to either the method #each or it can be a lambda/block, returning such a source. ERROR end end # Get the actual source if it is wrapped in a time # capsule, i.e. a block/lambda. # def unblock_source @source.respond_to?(:call) ? @source.call : @source end end end end
Version data entries
38 entries across 38 versions & 1 rubygems