confused

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

confused

RubyOnRails Users mailing list-2
    output.each{|o| o.map!{|i| {:space_nickname => i.space.nickname, :nickname => i.nickname, :condition_number => i.condition,
                                :condition => report_config.slider_order[i.condition][1],
                                :full_note => "#{i.full_note.strip} \n #{i.photos.select{|p| !p.caption.blank? }.map{|p|
                                  "[Photo #{photo_number_for(report.photo_numbers.hash, p)}] #{p.caption}"
                                }.compact.join("\n")}".strip,
                                :description => i.description, :trade => i.trade, :flagged => !i.require_maintenance.blank? }}}
    output.reject(&:empty?)

My coworker says it is valid Ruby, but Emacs highliting gets mangled. Does anybody know where I should report issues with that? I could only find an svn repo for that particular plugin for Emacs. 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/96a00157-73e9-479e-bd3c-2b1137c4e3ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: confused

Rob Biedenharn-3

> On 2017-Jul-11, at 14:52 , 'Bigos' via Ruby on Rails: Talk <[hidden email]> wrote:
>
>     output.each{|o| o.map!{|i| {:space_nickname => i.space.nickname, :nickname => i.nickname, :condition_number => i.condition,
>                                 :condition => report_config.slider_order[i.condition][1],
>                                 :full_note => "#{i.full_note.strip} \n #{i.photos.select{|p| !p.caption.blank? }.map{|p|
>                                   "[Photo #{photo_number_for(report.photo_numbers.hash, p)}] #{p.caption}"
>                                 }.compact.join("\n")}".strip,
>                                 :description => i.description, :trade => i.trade, :flagged => !i.require_maintenance.blank? }}}
>     output.reject(&:empty?)
>
> My coworker says it is valid Ruby, but Emacs highliting gets mangled. Does anybody know where I should report issues with that? I could only find an svn repo for that particular plugin for Emacs.  


Where is the closing quote for the line that starts with:
        :full_note => "
If you have "nested" quotes inside interpolations, perhaps you need to use %{} instead of ""

Or, perhaps even better, don't try to be so clever and compact:

output.each {|o|
  o.map! {|i|
    full_note = [i.full_note.strip]
    i.photos.each do |photo|
      next if photo.caption.blank?
      full_note <<  "[Photo #{photo_number_for(report.photo_numbers.hash, photo)}] #{photo.caption}"
    end
    {
      :space_nickname => i.space.nickname,
      :nickname => i.nickname,
      :condition_number => i.condition,
      :condition => report_config.slider_order[i.condition][1],
      :full_note => full_note.join("\n").strip,
      :description => i.description,
      :trade => i.trade,
      :flagged => !i.require_maintenance.blank?
    }
  }
}
output.reject(&:empty?)

-Rob

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CC271BE7-2666-43A3-84F3-3CC9BC760516%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...