argh 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,10 +9,10 @@ module Argh
9
9
  instance_eval(&block)
10
10
  end
11
11
 
12
- def attribute(name, &block)
12
+ def attribute(name, attribute = nil, &block)
13
13
  @attributes << {
14
14
  :name => name,
15
- :lambda => block || lambda { |i| i.send(name) }
15
+ :lambda => block || lambda { |i| i.send(attribute || name) }
16
16
  }
17
17
  end
18
18
 
data/lib/argh/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Argh
2
2
 
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
 
5
5
  end
@@ -23,6 +23,10 @@ class BasicExample
23
23
  attribute(:name) { name.reverse }
24
24
  end
25
25
 
26
+ argh 'symb' do
27
+ attribute(:the_name, :name)
28
+ end
29
+
26
30
  private
27
31
 
28
32
  def name
@@ -65,4 +69,8 @@ describe Argh::Attributable do
65
69
  example.lambs.should == '-name \'izzeperC nhoJ\''
66
70
  end
67
71
 
72
+ it 'should be able to specify a symbol instead of a lambda' do
73
+ example.symb.should == '-the_name \'John Crepezzi\''
74
+ end
75
+
68
76
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: argh
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:
8
- - John Crepezzi
8
+ - Broadstreet Ads
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-13 00:00:00.000000000 Z
12
+ date: 2012-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -33,16 +33,16 @@ executables: []
33
33
  extensions: []
34
34
  extra_rdoc_files: []
35
35
  files:
36
- - lib/argh/attributable.rb
37
- - lib/argh/collector.rb
38
36
  - lib/argh/formatters/base_formatter.rb
39
37
  - lib/argh/formatters/jcommander_formatter.rb
40
38
  - lib/argh/formatters.rb
39
+ - lib/argh/attributable.rb
40
+ - lib/argh/collector.rb
41
41
  - lib/argh/version.rb
42
42
  - lib/argh.rb
43
+ - spec/spec_helper.rb
43
44
  - spec/examples/basic_spec.rb
44
45
  - spec/examples/jcommander_spec.rb
45
- - spec/spec_helper.rb
46
46
  homepage: https://github.com/broadstreetads/argh
47
47
  licenses: []
48
48
  post_install_message:
@@ -68,6 +68,6 @@ signing_key:
68
68
  specification_version: 3
69
69
  summary: Easy command-line arguments
70
70
  test_files:
71
+ - spec/spec_helper.rb
71
72
  - spec/examples/basic_spec.rb
72
73
  - spec/examples/jcommander_spec.rb
73
- - spec/spec_helper.rb