Skip to content

Instantly share code, notes, and snippets.

@jeffkreeftmeijer
Forked from andremedeiros/options.rb
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save jeffkreeftmeijer/99ac66a9665ae8cc6b12 to your computer and use it in GitHub Desktop.

Select an option

Save jeffkreeftmeijer/99ac66a9665ae8cc6b12 to your computer and use it in GitHub Desktop.

Revisions

  1. Jeff Kreeftmeijer revised this gist Dec 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion options.rb
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@
    # Option 3 (brevity)
    info = publication ? "Title: #{ publication.title } (ID: #{ publication.id })" : 'N/A'

    # Option 4 (readbility)
    # Option 4 (readability)
    if publication
    info = "Title: #{ publication.title } (ID: #{ publication.id })"
    else
  2. Jeff Kreeftmeijer revised this gist Dec 16, 2014. 1 changed file with 9 additions and 2 deletions.
    11 changes: 9 additions & 2 deletions options.rb
    Original file line number Diff line number Diff line change
    @@ -11,5 +11,12 @@
    when nil then puts 'N/A'
    end

    # Option 3
    info = publication ? "Title: #{ publication.title } (ID: #{ publication.id })" : 'N/A'
    # Option 3 (brevity)
    info = publication ? "Title: #{ publication.title } (ID: #{ publication.id })" : 'N/A'

    # Option 4 (readbility)
    if publication
    info = "Title: #{ publication.title } (ID: #{ publication.id })"
    else
    info = 'N/A'
    end
  3. Jeff Kreeftmeijer revised this gist Dec 16, 2014. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion options.rb
    Original file line number Diff line number Diff line change
    @@ -9,4 +9,7 @@
    info = case publication
    when Publication then puts "Title: #{ publication.title } (ID: #{ publication.id })"
    when nil then puts 'N/A'
    end
    end

    # Option 3
    info = publication ? "Title: #{ publication.title } (ID: #{ publication.id })" : 'N/A'
  4. André Medeiros revised this gist Dec 16, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion options.rb
    Original file line number Diff line number Diff line change
    @@ -8,5 +8,5 @@
    # Option 2
    info = case publication
    when Publication then puts "Title: #{ publication.title } (ID: #{ publication.id })"
    when nil then puts 'N/A'
    when nil then puts 'N/A'
    end
  5. André Medeiros created this gist Dec 16, 2014.
    12 changes: 12 additions & 0 deletions options.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    # Option 1
    info = if publication
    "Title: #{ publication.title } (ID: #{ publication.id })"
    else
    'N/A'
    end

    # Option 2
    info = case publication
    when Publication then puts "Title: #{ publication.title } (ID: #{ publication.id })"
    when nil then puts 'N/A'
    end