Sha256: 6f92567f3860ca434b535a349b27455eae6aeb083b623f7dbd5103fcd45f0fec

Contents?: true

Size: 656 Bytes

Versions: 2

Compression:

Stored size: 656 Bytes

Contents

module Piglet
  class Load # :nodoc:
    include Relation
    include LoadAndStore
    
    def initialize(path, options={})
      options ||= {}
      @path, @using, @schema = path, options[:using], options[:schema]
    end
    
    def to_s
      str  = "LOAD '#{@path}'"
      str << " USING #{resolve_load_store_function(@using)}" if @using
      str << " AS (#{schema_string})" if @schema
      str
    end
    
  private
        
    def schema_string
      @schema.map do |field|
        if field.is_a?(Enumerable)
          field.map { |f| f.to_s }.join(':')
        else
          field.to_s
        end
      end.join(', ')
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
piglet-0.1.1 lib/piglet/load.rb
piglet-0.1.0 lib/piglet/load.rb