Module: Tynn::Environment::ClassMethods

Defined in:
lib/tynn/environment.rb

Instance Method Summary collapse

Instance Method Details

#development?Boolean

Public: Returns true if the current environment is :development. Otherwise returns false.

Examples

Tynn.set(:environment, :test)
Tynn.development? # => false

Tynn.set(:environment, :development)
Tynn.development? # => true

Returns:

  • (Boolean)


57
58
59
# File 'lib/tynn/environment.rb', line 57

def development?
  return environment == :development
end

#environmentObject

Public: Returns current environment.

Examples

Tynn.environment
# => :development

Tynn.set(:environment, :test)

Tynn.environment
# => :test


42
43
44
# File 'lib/tynn/environment.rb', line 42

def environment
  return settings[:environment]
end

#production?Boolean

Public: Returns true if the current environment is :production. Otherwise returns false.

Examples

Tynn.set(:environment, :development)
Tynn.production? # => false

Tynn.set(:environment, :production)
Tynn.production? # => true

Returns:

  • (Boolean)


87
88
89
# File 'lib/tynn/environment.rb', line 87

def production?
  return environment == :production
end

#test?Boolean

Public: Returns true if the current environment is :test. Otherwise returns false.

Examples

Tynn.set(:environment, :development)
Tynn.test? # => false

Tynn.set(:environment, :test)
Tynn.test? # => true

Returns:

  • (Boolean)


72
73
74
# File 'lib/tynn/environment.rb', line 72

def test?
  return environment == :test
end