Sha256: 72b8d4286b33bccc6343e20b06a6dcaeb6aee965b71c0775a35cd7c7b92b02ec

Contents?: true

Size: 1.57 KB

Versions: 3

Compression:

Stored size: 1.57 KB

Contents

require 'lotus/version'
require 'lotus/application'
require 'lotus/container'
require 'lotus/environment'

# A complete web framework for Ruby
#
# @since 0.1.0
#
# @see http://lotusrb.org
module Lotus
  # Return root of the project (top level directory).
  #
  # @return [Pathname] root path
  #
  # @since 0.3.2
  #
  # @example
  #   Lotus.root # => #<Pathname:/Users/luca/Code/bookshelf>
  def self.root
    environment.root
  end

  # Return the current environment
  #
  # @return [String] the current environment
  #
  # @since 0.3.1
  #
  # @see Lotus::Environment#environment
  #
  # @example
  #   Lotus.env => "development"
  def self.env
    environment.environment
  end

  # Check to see if specified environment(s) matches the current environment.
  #
  # If multiple names are given, it returns true, if at least one of them
  # matches the current environment.
  #
  # @return [TrueClass,FalseClass] the result of the check
  #
  # @since 0.3.1
  #
  # @see Lotus.env
  #
  # @example Single name
  #   puts ENV['LOTUS_ENV'] # => "development"
  #
  #   Lotus.env?(:development)  # => true
  #   Lotus.env?('development') # => true
  #
  #   Lotus.env?(:production)   # => false
  #
  # @example Multiple names
  #   puts ENV['LOTUS_ENV'] # => "development"
  #
  #   Lotus.env?(:development, :test)   # => true
  #   Lotus.env?(:production, :staging) # => false
  def self.env?(*names)
    environment.environment?(*names)
  end

  # Return environment
  #
  # @return [Lotus::Environment] environment
  #
  # @api private
  # @since 0.3.2
  def self.environment
    Environment.new
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lotusrb-0.5.0 lib/lotus.rb
lotusrb-0.4.1 lib/lotus.rb
lotusrb-0.4.0 lib/lotus.rb