Class: Pig
- Inherits:
-
Object
- Object
- Pig
- Defined in:
- lib/pig.rb
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
Instance Method Summary collapse
- #call(env) ⇒ Object
- #history ⇒ Object
-
#initialize(options) ⇒ Pig
constructor
A new instance of Pig.
- #rack_response_template ⇒ Object
Constructor Details
#initialize(options) ⇒ Pig
Returns a new instance of Pig.
10 11 12 |
# File 'lib/pig.rb', line 10 def initialize @format = [:format] end |
Instance Attribute Details
#format ⇒ Object
Returns the value of attribute format.
8 9 10 |
# File 'lib/pig.rb', line 8 def format @format end |
Instance Method Details
#call(env) ⇒ Object
23 24 25 |
# File 'lib/pig.rb', line 23 def call env rack_response_template << [history] end |
#history ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/pig.rb', line 14 def history results = "" commits = repository.log(NUMBER_OF_COMMITS) || [] commits.each do |commit| results << format_commit(commit) end wrap(results) end |
#rack_response_template ⇒ Object
27 28 29 |
# File 'lib/pig.rb', line 27 def rack_response_template [200, {"Content-Type" => "text/#{@format}"}] end |