Module: AuthAssistant::Helpers::LocalHost

Defined in:
lib/auth_assistant/helpers/localhost.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



16
17
18
# File 'lib/auth_assistant/helpers/localhost.rb', line 16

def self.included(base)
  base.helper_method :localhost_block, :not_localhost_block, :localhost?      
end

Instance Method Details

#localhost?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/auth_assistant/helpers/localhost.rb', line 12

def localhost?
   ['localhost', '127.0.0.1'].include?(request.host)
end

#localhost_block(&block) ⇒ Object



4
5
6
# File 'lib/auth_assistant/helpers/localhost.rb', line 4

def localhost_block(&block)
  with_output_buffer(&block) if localhost?      
end

#not_localhost_block(&block) ⇒ Object



8
9
10
# File 'lib/auth_assistant/helpers/localhost.rb', line 8

def not_localhost_block(&block)
  with_output_buffer(&block) if !localhost?
end