Class: Grog::Options
- Inherits:
-
Object
- Object
- Grog::Options
- Defined in:
- lib/grog/options.rb
Instance Attribute Summary collapse
-
#number_of_commits_to_show ⇒ Object
Returns the value of attribute number_of_commits_to_show.
-
#show_datetimes ⇒ Object
Returns the value of attribute show_datetimes.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize(argv) ⇒ Options
Returns a new instance of Options.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/grog/options.rb', line 11 def initialize(argv) @opts = OptionParser.new @number_of_commits_to_show = 10 @opts.on("-n=N", "number of commits to show", Integer) { |val| @number_of_commits_to_show = val } @show_datetimes = false @opts.on("-d", "show datetimes") { @show_datetimes = true } @opts.on_tail("-h", "--help", "Show this message") do puts @opts exit end @opts.on_tail("--version", "Show the version of the grog gem") do puts "grog v" + `cat VERSION` end @rest = @opts.parse(argv) end |
Instance Attribute Details
#number_of_commits_to_show ⇒ Object
Returns the value of attribute number_of_commits_to_show.
5 6 7 |
# File 'lib/grog/options.rb', line 5 def number_of_commits_to_show @number_of_commits_to_show end |
#show_datetimes ⇒ Object
Returns the value of attribute show_datetimes.
5 6 7 |
# File 'lib/grog/options.rb', line 5 def show_datetimes @show_datetimes end |