Sha256: c79c65bde21486a02d035940b3246691e650e81c75982e4565b6ca3868ec529c

Contents?: true

Size: 630 Bytes

Versions: 66

Compression:

Stored size: 630 Bytes

Contents

module Bmg
  module Sql
    class Processor
      class Rename < Processor

        def initialize(renaming, builder)
          super(builder)
          @renaming = renaming
        end

        def on_select_list(sexpr)
          sexpr.each_with_index.map{|child,index|
            index == 0 ? child : apply(child)
          }
        end

        def on_select_item(sexpr)
          return sexpr unless newname = @renaming[sexpr.as_name.to_sym]
          builder.select_item(sexpr.qualifier, sexpr.would_be_name, newname.to_s)
        end

      end # class Rename
    end # class Processor
  end # module Sql
end # module Bmg

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
bmg-0.23.3 lib/bmg/sql/processor/rename.rb
bmg-0.23.2 lib/bmg/sql/processor/rename.rb
bmg-0.23.1 lib/bmg/sql/processor/rename.rb
bmg-0.23.0 lib/bmg/sql/processor/rename.rb
bmg-0.21.5 lib/bmg/sql/processor/rename.rb
bmg-0.21.4 lib/bmg/sql/processor/rename.rb
bmg-0.20.5 lib/bmg/sql/processor/rename.rb
bmg-0.19.3 lib/bmg/sql/processor/rename.rb
bmg-0.21.3 lib/bmg/sql/processor/rename.rb
bmg-0.21.2 lib/bmg/sql/processor/rename.rb
bmg-0.21.0 lib/bmg/sql/processor/rename.rb
bmg-0.20.4 lib/bmg/sql/processor/rename.rb
bmg-0.20.2 lib/bmg/sql/processor/rename.rb
bmg-0.20.1 lib/bmg/sql/processor/rename.rb
bmg-0.20.0 lib/bmg/sql/processor/rename.rb
bmg-0.19.2 lib/bmg/sql/processor/rename.rb
bmg-0.19.1 lib/bmg/sql/processor/rename.rb
bmg-0.19.0 lib/bmg/sql/processor/rename.rb
bmg-0.18.15 lib/bmg/sql/processor/rename.rb
bmg-0.18.14 lib/bmg/sql/processor/rename.rb