Class: Alephant::Broker::Environment

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/alephant/broker/environment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ Environment

Returns a new instance of Environment.



11
12
13
# File 'lib/alephant/broker/environment.rb', line 11

def initialize(env)
  @settings = env
end

Instance Attribute Details

#settingsObject (readonly)

Returns the value of attribute settings.



9
10
11
# File 'lib/alephant/broker/environment.rb', line 9

def settings
  @settings
end

Instance Method Details

#dataObject



47
48
49
# File 'lib/alephant/broker/environment.rb', line 47

def data
  parse(rack_input) if post?
end

#get?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/alephant/broker/environment.rb', line 23

def get?
  settings["REQUEST_METHOD"] == "GET"
end

#if_modified_sinceObject



43
44
45
# File 'lib/alephant/broker/environment.rb', line 43

def if_modified_since
  settings["HTTP_IF_MODIFIED_SINCE"]
end

#if_none_matchObject



39
40
41
# File 'lib/alephant/broker/environment.rb', line 39

def if_none_match
  settings["HTTP_IF_NONE_MATCH"]
end

#methodObject



15
16
17
# File 'lib/alephant/broker/environment.rb', line 15

def method
  settings["REQUEST_METHOD"]
end

#optionsObject



51
52
53
# File 'lib/alephant/broker/environment.rb', line 51

def options
  Rack::Utils.parse_nested_query query
end

#options?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/alephant/broker/environment.rb', line 27

def options?
  settings["REQUEST_METHOD"] == "OPTIONS"
end

#pathObject



35
36
37
# File 'lib/alephant/broker/environment.rb', line 35

def path
  settings["PATH_INFO"]
end

#post?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/alephant/broker/environment.rb', line 19

def post?
  settings["REQUEST_METHOD"] == "POST"
end

#queryObject



31
32
33
# File 'lib/alephant/broker/environment.rb', line 31

def query
  settings["QUERY_STRING"] || ""
end