Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
refactor: some code refactroing
Browse files Browse the repository at this point in the history
  • Loading branch information
ninoseki committed Oct 13, 2018
1 parent fa01365 commit 3abf3e4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
16 changes: 5 additions & 11 deletions app/lib/rack/baseup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,11 @@ class BaseUp
# @param [Rack::Request] req
# @return [String]
def request_info(req)
arr = []
arr << request_line(req)
arr += request_headers(req)

body = request_body(req)
unless body.empty?
arr << ""
arr << body
end

arr.join("\n")
[
request_line(req),
request_headers(req),
request_body(req) || ""
].join("\n")
end

# Returns Base64 encoded HTTP request information
Expand Down
2 changes: 1 addition & 1 deletion app/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def call(_)
#
# @return [Array<String>]
def defaults
Dir.glob(File.expand_path("defaults/**/*.yml", __dir__))
@defaults ||= Dir.glob(File.expand_path("defaults/**/*.yml", __dir__))
end
end
end
6 changes: 1 addition & 5 deletions app/mrr.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ def response
def valid?
return false unless attributes.is_a? Hash

begin
meta? && trigger? && response?
rescue NoMethodError
false
end
respond_to?(:meta?) && respond_to?(:trigger?) && respond_to?(:response?)
end

def response?
Expand Down

0 comments on commit 3abf3e4

Please sign in to comment.