Module: Rails

Defined in:
lib/rails_ext/basic/handy_environment.rb

Class Method Summary collapse

Class Method Details

.development(*args, &block) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/rails_ext/basic/handy_environment.rb', line 15

def development *args, &block
  if development?
    if block 
      block.call
    else
      return *args
    end
  end
end

.development?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/rails_ext/basic/handy_environment.rb', line 3

def development?
  RAILS_ENV == 'development'
end

.production(*args, &block) ⇒ Object



35
36
37
38
39
40
41
42
43
# File 'lib/rails_ext/basic/handy_environment.rb', line 35

def production *args, &block
  if production?
    if block 
      block.call
    else
      return *args
    end
  end
end

.production?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/rails_ext/basic/handy_environment.rb', line 11

def production?
  RAILS_ENV == 'production'
end

.test(*args, &block) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/rails_ext/basic/handy_environment.rb', line 25

def test *args, &block
  if test?
    if block 
      block.call
    else
      return *args
    end
  end
end

.test?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/rails_ext/basic/handy_environment.rb', line 7

def test?
  RAILS_ENV == 'test'
end