Class: InchCI::Worker::BuildJSON::JSONDump
- Inherits:
-
Object
- Object
- InchCI::Worker::BuildJSON::JSONDump
- Defined in:
- lib/inch_ci/worker/build_json.rb
Instance Attribute Summary collapse
-
#branch_name ⇒ Object
readonly
Returns the value of attribute branch_name.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#nwo ⇒ Object
readonly
Returns the value of attribute nwo.
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #circleci? ⇒ Boolean
-
#initialize(filename) ⇒ JSONDump
constructor
A new instance of JSONDump.
- #shell? ⇒ Boolean
- #to_h(include_objects: true) ⇒ Object
- #travis? ⇒ Boolean
Constructor Details
#initialize(filename) ⇒ JSONDump
Returns a new instance of JSONDump.
13 14 15 16 17 18 19 20 21 |
# File 'lib/inch_ci/worker/build_json.rb', line 13 def initialize(filename) contents = File.read(filename, :encoding => 'utf-8') @json = JSON[contents] @language = @json['language'] @branch_name = @json['branch_name'] || @json['travis_branch'] @revision = @json['revision'] || @json['travis_commit'] @nwo = @json['nwo'] || @json['travis_repo_slug'] @url = @json['git_repo_url'] end |
Instance Attribute Details
#branch_name ⇒ Object (readonly)
Returns the value of attribute branch_name.
11 12 13 |
# File 'lib/inch_ci/worker/build_json.rb', line 11 def branch_name @branch_name end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
11 12 13 |
# File 'lib/inch_ci/worker/build_json.rb', line 11 def language @language end |
#nwo ⇒ Object (readonly)
Returns the value of attribute nwo.
11 12 13 |
# File 'lib/inch_ci/worker/build_json.rb', line 11 def nwo @nwo end |
#revision ⇒ Object (readonly)
Returns the value of attribute revision.
11 12 13 |
# File 'lib/inch_ci/worker/build_json.rb', line 11 def revision @revision end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
11 12 13 |
# File 'lib/inch_ci/worker/build_json.rb', line 11 def url @url end |
Instance Method Details
#circleci? ⇒ Boolean
27 28 29 |
# File 'lib/inch_ci/worker/build_json.rb', line 27 def circleci? !@json['circleci'].nil? end |
#shell? ⇒ Boolean
23 24 25 |
# File 'lib/inch_ci/worker/build_json.rb', line 23 def shell? !@json['shell'].nil? end |
#to_h(include_objects: true) ⇒ Object
35 36 37 38 39 |
# File 'lib/inch_ci/worker/build_json.rb', line 35 def to_h(include_objects: true) h = @json.dup h.delete('objects') unless include_objects h end |
#travis? ⇒ Boolean
31 32 33 |
# File 'lib/inch_ci/worker/build_json.rb', line 31 def travis? !@json['travis'].nil? end |