cossincalc 1.0.9 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,7 +3,7 @@
3
3
  ## Copyright:: Copyright 2007 William Morgan
4
4
  ## License:: the same terms as ruby itself
5
5
 
6
- require 'date'
6
+ ## Mofified 2011-06-25: All references to Date type removed!
7
7
 
8
8
  module Trollop
9
9
 
@@ -47,12 +47,12 @@ class Parser
47
47
  ##
48
48
  ## A value of +io+ corresponds to a readable IO resource, including
49
49
  ## a filename, URI, or the strings 'stdin' or '-'.
50
- SINGLE_ARG_TYPES = [:int, :integer, :string, :double, :float, :io, :date]
50
+ SINGLE_ARG_TYPES = [:int, :integer, :string, :double, :float, :io]
51
51
 
52
52
  ## The set of values that indicate a multiple-parameter option (i.e., that
53
53
  ## takes multiple space-separated values on the commandline) when passed as
54
54
  ## the +:type+ parameter of #opt.
55
- MULTI_ARG_TYPES = [:ints, :integers, :strings, :doubles, :floats, :ios, :dates]
55
+ MULTI_ARG_TYPES = [:ints, :integers, :strings, :doubles, :floats, :ios]
56
56
 
57
57
  ## The complete set of legal values for the +:type+ parameter of #opt.
58
58
  TYPES = FLAG_TYPES + SINGLE_ARG_TYPES + MULTI_ARG_TYPES
@@ -140,7 +140,6 @@ class Parser
140
140
  when 'Integer'; :int
141
141
  when 'Float'; :float
142
142
  when 'IO'; :io
143
- when 'Date'; :date
144
143
  else
145
144
  raise ArgumentError, "unsupported argument type '#{opts[:type].class.name}'"
146
145
  end
@@ -168,7 +167,6 @@ class Parser
168
167
  when TrueClass, FalseClass; :flag
169
168
  when String; :string
170
169
  when IO; :io
171
- when Date; :date
172
170
  when Array
173
171
  if opts[:default].empty?
174
172
  raise ArgumentError, "multiple argument type cannot be deduced from an empty array for '#{opts[:default][0].class.name}'"
@@ -178,7 +176,6 @@ class Parser
178
176
  when Numeric; :floats
179
177
  when String; :strings
180
178
  when IO; :ios
181
- when Date; :dates
182
179
  else
183
180
  raise ArgumentError, "unsupported multiple argument type '#{opts[:default][0].class.name}'"
184
181
  end
@@ -377,8 +374,6 @@ class Parser
377
374
  vals[sym] = params.map { |pg| pg.map { |p| p.to_s } }
378
375
  when :io, :ios
379
376
  vals[sym] = params.map { |pg| pg.map { |p| parse_io_parameter p, arg } }
380
- when :date, :dates
381
- vals[sym] = params.map { |pg| pg.map { |p| parse_date_parameter p, arg } }
382
377
  end
383
378
 
384
379
  if SINGLE_ARG_TYPES.include?(opts[:type])
@@ -407,19 +402,6 @@ class Parser
407
402
  vals
408
403
  end
409
404
 
410
- def parse_date_parameter param, arg #:nodoc:
411
- begin
412
- begin
413
- time = Chronic.parse(param)
414
- rescue NameError
415
- # chronic is not available
416
- end
417
- time ? Date.new(time.year, time.month, time.day) : Date.parse(param)
418
- rescue ArgumentError => e
419
- raise CommandlineError, "option '#{arg}' needs a date"
420
- end
421
- end
422
-
423
405
  ## Print the help message to +stream+.
424
406
  def educate stream=$stdout
425
407
  width # just calculate it now; otherwise we have to be careful not to
@@ -439,8 +421,6 @@ class Parser
439
421
  when :floats; " <f+>"
440
422
  when :io; " <filename/uri>"
441
423
  when :ios; " <filename/uri+>"
442
- when :date; " <date>"
443
- when :dates; " <date+>"
444
424
  end
445
425
  end
446
426
 
@@ -1,3 +1,3 @@
1
1
  module CosSinCalc
2
- VERSION = "1.0.9"
2
+ VERSION = "1.0.10"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cossincalc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 9
10
- version: 1.0.9
9
+ - 10
10
+ version: 1.0.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Molte Emil Strange Andersen