Sha256: b3fb604910b7f69d8e90b0951cd765dd500a4ee54c4822985392db8645619e65

Contents?: true

Size: 1.29 KB

Versions: 6

Compression:

Stored size: 1.29 KB

Contents

module Alf
  module Shell
    class Alfrc < Support::Config

      # Path to be put in $LOAD_PATH before executing alf
      option :load_paths, Array, []

      # Libraries to require before executing alf
      option :requires, Array, []

      # Default renderer to use for outputting relations
      option :default_renderer, Class, ->{ $stdout.tty? ? Renderer::Text : Renderer::Rash }

      # Default reader name to use for reading on stdin
      option :stdin_reader, Symbol, :rash

      # Float format to use
      option :float_format, String, "%.3f"

      # Pretty print in console mode?
      option :pretty, Boolean, ->{ $stdout.tty? }

      # The adapter to use by default
      option :adapter, Object, ->{ Path.pwd } 

      # The database to use by default
      option :database, Database, ->{ Database.new(adapter) }

      # The viewpoint to use by default
      option :viewpoint, Module, ->{ Viewpoint::NATIVE }

      # If `path` is provided, evaluates the content of the file on this
      # instance. Also, if a block is passed, yields it with self. Return
      # self in any case.
      def alfrc(path = nil)
        ::Kernel.eval(Path(path).read, binding, path.to_s) if path
        yield(self) if block_given?
        self
      end

    end # class Alfrc
  end # module Shell
end # module Alf

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
alf-shell-0.16.4 lib/alf/shell/alfrc.rb
alf-shell-0.16.3 lib/alf/shell/alfrc.rb
alf-shell-0.16.2 lib/alf/shell/alfrc.rb
alf-shell-0.16.1 lib/alf/shell/alfrc.rb
alf-shell-0.16.0 lib/alf/shell/alfrc.rb
alf-shell-0.15.0 lib/alf/shell/alfrc.rb