As I mentioned in http://www.ruby-forum.com/topic/177503 I can''t pass
arguments to rails generator. After a couple hours I find a dirty hack
def add_options!(opt)
....
opt.on("--option_name","Some Text") { |v|
options[:option_name] = arg[0]
}
but regardless what i do the options hash still ''ll contain the logical
true for defined arguments (def add_options!(opt)).
Only arg array ''ll contain the runtime argument''s value.
Any help is welcome to solve this uggly, dirty ... hack
Thanks kfl62
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Ferenc-Lorant Kiss wrote:> As I mentioned in http://www.ruby-forum.com/topic/177503 I can''t pass > arguments to rails generator. After a couple hours I find a dirty hack > > def add_options!(opt) > .... > opt.on("--option_name","Some Text") { |v| options[:option_name] = arg[0] > } > > but regardless what i do the options hash still ''ll contain the logical > true for defined arguments (def add_options!(opt)). > > Only arg array ''ll contain the runtime argument''s value. > > Any help is welcome to solve this uggly, dirty ... hack > > Thanks kfl62the source, maybe helps ... http://github.com/kfl62/trst_sys/tree/master/lib/generators/task_partial -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Shame on me I used --option_name and of course was returned a logical true> opt.on("--option_name","Some Text") { |v| options[:option_name] = arg[0]}If I use --option_name=name returns args value :) opt.on("--option_name=name","Some Text") { |v| options[:option_name] = v} -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---