Skip to content

Commit

Permalink
Merge 743a149 into cfe555e
Browse files Browse the repository at this point in the history
  • Loading branch information
fuadsaud committed Jun 26, 2014
2 parents cfe555e + 743a149 commit 3fb3c4c
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 30 deletions.
2 changes: 1 addition & 1 deletion lib/lotus/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def self.included(base)
end
end

protected
private

# Finalize the response
#
Expand Down
2 changes: 1 addition & 1 deletion lib/lotus/action/callable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def call(env)
finish
end

protected
private

# Prepare the Rack response before the control is returned to the
# webserver.
Expand Down
3 changes: 2 additions & 1 deletion lib/lotus/action/configurable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def self.included(base)
config.load!(base)
end

protected
private

def configuration
self.class.configuration
end
Expand Down
3 changes: 1 addition & 2 deletions lib/lotus/action/cookies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ module Action
#
# @see Lotus::Action::Cookies#cookies
module Cookies

protected
private

# Finalize the response by flushing cookies into the response
#
Expand Down
5 changes: 3 additions & 2 deletions lib/lotus/action/mime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def format_to_mime_type(format)
raise Lotus::Controller::UnknownFormatError.new(format)
end

protected
private

# Restrict the access to the specified mime type symbols.
#
Expand Down Expand Up @@ -176,7 +176,8 @@ def content_type
@content_type || accepts || default_content_type || DEFAULT_CONTENT_TYPE
end

protected
private

# Finalize the response by setting the current content type
#
# @since 0.1.0
Expand Down
43 changes: 23 additions & 20 deletions lib/lotus/action/rack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,54 +90,57 @@ def use(middleware)
end

protected
# Sets the HTTP status code for the response

# Gets the headers from the response
#
# @param status [Fixnum] an HTTP status code
# @return [void]
# @return [Hash] the HTTP headers from the response
#
# @since 0.1.0
#
# @example
# require 'lotus/controller'
#
# class Create
# class Show
# include Lotus::Action
#
# def call(params)
# # ...
# self.status = 201
# self.headers # => { ... }
# self.headers.merge!({'X-Custom' => 'OK'})
# end
# end
def status=(status)
@_status = status
def headers
@headers
end

# Sets the body of the response
private

# Sets the HTTP status code for the response
#
# @param body [String] the body of the response
# @param status [Fixnum] an HTTP status code
# @return [void]
#
# @since 0.1.0
#
# @example
# require 'lotus/controller'
#
# class Show
# class Create
# include Lotus::Action
#
# def call(params)
# # ...
# self.body = 'Hi!'
# self.status = 201
# end
# end
def body=(body)
body = Array(body) unless body.respond_to?(:each)
@_body = body
def status=(status)
@_status = status
end

# Gets the headers from the response
# Sets the body of the response
#
# @return [Hash] the HTTP headers from the response
# @param body [String] the body of the response
# @return [void]
#
# @since 0.1.0
#
Expand All @@ -149,12 +152,12 @@ def body=(body)
#
# def call(params)
# # ...
# self.headers # => { ... }
# self.headers.merge!({'X-Custom' => 'OK'})
# self.body = 'Hi!'
# end
# end
def headers
@headers
def body=(body)
body = Array(body) unless body.respond_to?(:each)
@_body = body
end

# Returns a serialized Rack response (Array), according to the current
Expand Down
2 changes: 1 addition & 1 deletion lib/lotus/action/redirect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Redirect
# @api private
LOCATION = 'Location'.freeze

protected
private

# Redirect to the given URL
#
Expand Down
2 changes: 1 addition & 1 deletion lib/lotus/action/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Session
# @api private
SESSION_KEY = 'rack.session'.freeze

protected
private

# Gets the session from the request and expose it as an Hash.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/lotus/action/throwable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def self.included(base)
end

module ClassMethods
protected
private

# Handle the given exception with an HTTP status code.
#
Expand Down
1 change: 1 addition & 0 deletions lib/lotus/controller/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ def load!(base)
end

protected

attr_accessor :handled_exceptions
attr_accessor :formats
attr_writer :action_module
Expand Down

0 comments on commit 3fb3c4c

Please sign in to comment.