Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save eprothro/41cbdbaa1cb5676e536d to your computer and use it in GitHub Desktop.
Save eprothro/41cbdbaa1cb5676e536d to your computer and use it in GitHub Desktop.
class Test
  
  def foo(value=default_value)
    value
  end

  def default_value
    'default'
  end
end
Test.new.foo('explicit')
=> "explicit"

Test.new.foo(nil)
=> nil

Test.new.foo
=> "default"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment