Class: GitVersion::Parser
- Inherits:
-
Object
- Object
- GitVersion::Parser
- Defined in:
- lib/git_version/parser.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#gitversion_exe ⇒ Object
Returns the value of attribute gitversion_exe.
Instance Method Summary collapse
-
#initialize(args = []) ⇒ Parser
constructor
A new instance of Parser.
- #inspect ⇒ Object
- #json ⇒ Object
- #method_missing(symbol, *args) ⇒ Object
Constructor Details
#initialize(args = []) ⇒ Parser
Returns a new instance of Parser.
9 10 11 |
# File 'lib/git_version/parser.rb', line 9 def initialize(args = []) @args = args end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/git_version/parser.rb', line 13 def method_missing(symbol, *args) keys = [symbol.to_s, pascal_case(symbol.to_s)] found_key = keys.find { |key| json.has_key?(key) } return json[found_key] if found_key super end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
6 7 8 |
# File 'lib/git_version/parser.rb', line 6 def args @args end |
#gitversion_exe ⇒ Object
Returns the value of attribute gitversion_exe.
7 8 9 |
# File 'lib/git_version/parser.rb', line 7 def gitversion_exe @gitversion_exe end |
Instance Method Details
#inspect ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/git_version/parser.rb', line 30 def inspect unless @json return <<EOF #{to_s} Will invoke #{cmd_string} when first used. EOF else return <<EOF #{to_s} Invoked #{cmd_string} and parsed its output: #{json.inspect} EOF end end |
#json ⇒ Object
22 23 24 |
# File 'lib/git_version/parser.rb', line 22 def json @json ||= run_gitversion end |