Skip to content
Browse files

Remove undesirable behavior

  • Loading branch information...
1 parent 4cbed09 commit 23ec20745bc4b9d038969bb6db76a2973f2715b3 @seejohnrun seejohnrun committed
Showing with 4 additions and 14 deletions.
  1. +1 −2 README.md
  2. +1 −6 lib/argh/collector.rb
  3. +2 −6 spec/examples/basic_spec.rb
View
3 README.md
@@ -26,7 +26,6 @@ class Thing
argh 'command_attributes' do
attribute(:name)
- attribute(:proxy_name, :name)
attribute(:reverse_name) { name.reverse }
attribute(:direct, 'value')
end
@@ -39,7 +38,7 @@ class Thing
end
-Thing.new.command_attributes # "-name 'Heyoo' -reverse_name 'ooyeH' -proxy_name 'Heyoo' -direct 'value'"
+Thing.new.command_attributes # "-name 'Heyoo' -reverse_name 'ooyeH' -direct 'value'"
```
The default formatter is built to work
View
7 lib/argh/collector.rb
@@ -10,15 +10,10 @@ def initialize(&block)
end
def attribute(name, value = nil, &block)
- attribute = nil
- if value.is_a?(Symbol)
- attribute = value
- value = nil
- end
@attributes << {
:name => name,
:value => value,
- :lambda => block || lambda { |i| i.send(attribute || name) }
+ :lambda => block || lambda { |i| i.send(name) }
}
end
View
8 spec/examples/basic_spec.rb
@@ -20,7 +20,7 @@ class BasicExample
end
argh 'straight' do
- attribute :name, 'john'
+ attribute :name, :john
end
argh 'lambs' do
@@ -28,7 +28,7 @@ class BasicExample
end
argh 'symb' do
- attribute(:the_name, :name)
+ attribute(:the_name, &:name)
end
private
@@ -77,8 +77,4 @@ def age
example.straight.should == '-name \'john\''
end
- it 'should be able to specify a symbol instead of a lambda' do
- example.symb.should == '-the_name \'John Crepezzi\''
- end
-
end

0 comments on commit 23ec207

Please sign in to comment.
Something went wrong with that request. Please try again.