Bugs: Browse | Submit New | Admin

[#20544] Long option with dash causes bad instance variable name failure

Date:
2008-06-06 03:50
Priority:
3
Submitted By:
Fran├žois Beausoleil (fbos)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
Long option with dash causes bad instance variable name failure

Detailed description
This script:

#!/usr/bin/env ruby
require "rubygems"
require "clip"
require "pathname"

options = Clip do |p|
  p.opt "P", "pid-file", :default => "log/program.pid" do |v|
    Pathname.new(v).real_path
  end
end

puts options.to_s

resulted in this:

$ ruby main.rb 
/Library/Ruby/Gems/1.8/gems/clip-0.0.3/lib/clip.rb:74:in `instance_variable_get': `@pid-file' is not allowed as an instance
variable name (NameError)
	from /Library/Ruby/Gems/1.8/gems/clip-0.0.3/lib/clip.rb:74:in `pid-file'
	from /Library/Ruby/Gems/1.8/gems/clip-0.0.3/lib/clip.rb:178:in `send'
	from /Library/Ruby/Gems/1.8/gems/clip-0.0.3/lib/clip.rb:178:in `parse'
	from /Library/Ruby/Gems/1.8/gems/clip-0.0.3/lib/clip.rb:177:in `each'
	from /Library/Ruby/Gems/1.8/gems/clip-0.0.3/lib/clip.rb:177:in `parse'
	from /Library/Ruby/Gems/1.8/gems/clip-0.0.3/lib/clip.rb:11:in `Clip'
	from main.rb:6

I tried pulling the Git repository from RubyForge, but was denied by RubyForge.  GitHub did it just fine.  Reading the
specs shows that I should have used the underscored name in the declaration, but it wasn't immediately clear.  Should
clip accept either and just map between one and the other as needed ?

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item