Sha256: a1153a1d4fbe918288b3d59d1533e8c7f94c5a264bdebdf72699b53eadf76924

Contents?: true

Size: 715 Bytes

Versions: 2

Compression:

Stored size: 715 Bytes

Contents

module Alf
  module Shell
    module Support

      def database
        requester && requester.database
      end

      def compiler
        @compiler ||= (database && database.connection.compiler) || Engine::Compiler.new(nil)
      end

      def operands(argv, size = nil)
        operands = [ stdin_operand ] + Array(argv)
        operands = operands[(operands.size - size)..-1] if size
        operands = operands.map{|arg|
          arg = Algebra.named_operand(arg.to_sym, database) if arg.is_a?(String)
          Algebra::Operand.coerce(arg)
        }
      end

      def stdin_operand
        requester.stdin_operand rescue $stdin
      end

    end # module Support
  end # module Shell
end # module Alf

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
alf-shell-0.13.1 lib/alf/shell/support.rb
alf-shell-0.13.0 lib/alf/shell/support.rb