Skip to content

Instantly share code, notes, and snippets.

@jamiehodge
Created November 11, 2015 20:19
Show Gist options
  • Save jamiehodge/d72fb1c86e6e2848a457 to your computer and use it in GitHub Desktop.
Save jamiehodge/d72fb1c86e6e2848a457 to your computer and use it in GitHub Desktop.
Private readers (dependencies)
require 'base64'
class Foo
def initialize(bar:, baz: Base64.method(:encode64))
@bar = bar
@baz = baz
end
def to_qux
baz.(bar)
end
private
attr_reader :bar, :baz
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment