Class: Hubeye::Commit
- Inherits:
-
Object
- Object
- Hubeye::Commit
- Defined in:
- lib/server/hubeye_server.rb
Overview
simple interface to Github’s api v3 for commits
Instance Attribute Summary collapse
-
#latest ⇒ Object
readonly
Returns the value of attribute latest.
-
#only_sha ⇒ Object
readonly
Returns the value of attribute only_sha.
-
#raw_input ⇒ Object
readonly
Returns the value of attribute raw_input.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
- #commit_message ⇒ Object
- #committer_name ⇒ Object
-
#initialize(input) ⇒ Commit
constructor
A new instance of Commit.
- #sha ⇒ Object
Constructor Details
#initialize(input) ⇒ Commit
Returns a new instance of Commit.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/server/hubeye_server.rb', line 9 def initialize(input) @raw_input = input @repo = input.keys.first if Hash === input if input[@repo].keys == ["sha"] @only_sha = true else @latest = true end else raise ArgumentError.new "input must be a kind of hash" end end |
Instance Attribute Details
#latest ⇒ Object (readonly)
Returns the value of attribute latest.
8 9 10 |
# File 'lib/server/hubeye_server.rb', line 8 def latest @latest end |
#only_sha ⇒ Object (readonly)
Returns the value of attribute only_sha.
8 9 10 |
# File 'lib/server/hubeye_server.rb', line 8 def only_sha @only_sha end |
#raw_input ⇒ Object (readonly)
Returns the value of attribute raw_input.
8 9 10 |
# File 'lib/server/hubeye_server.rb', line 8 def raw_input @raw_input end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
8 9 10 |
# File 'lib/server/hubeye_server.rb', line 8 def repo @repo end |
Instance Method Details
#commit_message ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/server/hubeye_server.rb', line 27 def if @only_sha return elsif @latest @commit_message ||= @raw_input[@repo]['commit']['message'] else raise end end |
#committer_name ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/server/hubeye_server.rb', line 37 def committer_name if @only_sha return elsif @latest @committer_name ||= @raw_input[@repo]['commit']['committer']['name'] else raise end end |
#sha ⇒ Object
23 24 25 |
# File 'lib/server/hubeye_server.rb', line 23 def sha @sha ||= @raw_input[@repo]['sha'] end |