como 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/como.rb +20 -4
  2. metadata +2 -2
data/lib/como.rb CHANGED
@@ -24,7 +24,7 @@
24
24
  # ] )
25
25
  #
26
26
  # puts "File option: #{Opt['file'].value}"
27
- # puts "Debugging selected!" if Opt['debug'].given?
27
+ # puts "Debugging selected!" if Opt['debug'].given
28
28
  #
29
29
  # "Spec.defineCheckHelp" method takes 4 arguments:
30
30
  # [progname] Name of the program (or command).
@@ -204,8 +204,8 @@
204
204
  # [none] No options are required.
205
205
  # [incr] Incremental options in order i.e. have to have previous to
206
206
  # have later.
207
- # [follow] Incremental options in order i.e. have to have later if has
208
- # previous (combined options).
207
+ # [follow] Incremental options in order i.e. have to have all later if
208
+ # had first.
209
209
 
210
210
  module Como
211
211
 
@@ -412,7 +412,7 @@ module Como
412
412
  attr_accessor :doc
413
413
 
414
414
  # Is option specified?
415
- attr_accessor :given
415
+ attr_writer :given
416
416
 
417
417
  # Is option hidden (usage).
418
418
  attr_accessor :silent
@@ -491,6 +491,22 @@ module Como
491
491
  end
492
492
 
493
493
 
494
+ # Returns true if option is given, and block is not
495
+ # present. When block is present, the block is executed (with
496
+ # value as parameter) if option has been given.
497
+ def given( &prog )
498
+ if block_given?
499
+ if @given
500
+ yield( @value )
501
+ else
502
+ false
503
+ end
504
+ else
505
+ @given
506
+ end
507
+ end
508
+
509
+
494
510
  # Check for any non-given required arguments.
495
511
  def Opt.checkMissing
496
512
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: como
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-13 00:00:00.000000000 Z
12
+ date: 2013-10-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Como provides low manifest command line option parsing and deployment.
15
15
  The command line options are described in compact table format and option values