Sha256: 9db504bf8e23eae0962546dab117be45f5f5a808e3cabe88548467bb138a2a86

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents

module Eco
  module API
    module Common
      module Session
        class BaseSession

          include Common::People

          attr_accessor :session
          attr_accessor :environment, :config
          alias_method :enviro, :environment
          alias_method :enviro=, :environment=

          attr_reader  :api, :file_manager, :logger
          alias_method :fm, :file_manager

          def initialize(e)
            raise "Expected object Eco::API::Common::Session::Environment. Given: #{e.class}" unless e.is_a?(Environment)
            #e = Environment.new(e) if !e.is_a?(Environment)
            self.environment = e   #if e.is_a?(Environment)
          end

          def session
            enviro.session
          end

          def environment=(value)
            @environment = nil
            @environment = value if value.is_a?(Environment)
          end

          def config
            enviro.config
          end

          def api
            enviro.api
          end

          def file_manager
            enviro.file_manager
          end

          def logger
            enviro.logger
          end

          # TODO: paremeter for the exception
          def fatal(msg)
            logger.fatal(msg)
            raise msg
          end

        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
eco-helpers-0.6.17 lib/eco/api/common/session/base_session.rb
eco-helpers-0.6.16 lib/eco/api/common/session/base_session.rb
eco-helpers-0.6.15 lib/eco/api/common/session/base_session.rb