Sha256: cec3c8658732010e63a6cf9320c2b70cb6c6aa09a07ee81df61720b41c0cc328

Contents?: true

Size: 379 Bytes

Versions: 3

Compression:

Stored size: 379 Bytes

Contents

module Transcriber
  class Resource
    module Parser
      module Embeddable
        def parse(value, resource = nil)
          parsed_value = parse? ? resource_class.parse(value) : value
          one? ? parsed_value.first : parsed_value
        end

        private

        def parse?
          ![Hash, Array].include?(resource_class)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
transcriber-0.0.5 lib/transcriber/resource/parser/embeddable.rb
transcriber-0.0.4 lib/transcriber/resource/parser/embeddable.rb
transcriber-0.0.3 lib/transcriber/resource/parser/embeddable.rb