Skip to content

Instantly share code, notes, and snippets.

@flazz
Created August 6, 2012 19:26
Show Gist options
  • Save flazz/3277783 to your computer and use it in GitHub Desktop.
Save flazz/3277783 to your computer and use it in GitHub Desktop.
class SomeClass
def initialize a, b, c
@a, @b, @c = a, b, c
end
private
def some_method x, y
@c.work_with x
@c.do_something y
end
public
def some_method2 x, y
if @a.foo? x
@c.do_something x
else
@c.do_something_else y
end
some_method x, y
end
def some_other_method
@a.foo @b unless c.baz?
end
def some_other_method2
@a.foo @b unless c.baz?
end
def some_other_method3
@a.foo @b unless c.boing?
end
end
class SomeClassPrime
class SomeInnerClass
def initialize @c, @x, @y
...
end
def some_method x, y
@c.work_with x
@c.do_something y
end
end
def initialize a, b, c
@a, @b, @c = a, b, c
end
def some_method2 x, y
inner = SomeInnerClass.new c, x, y
if @a.foo? x
inner.do_something
else
inner.do_something_else
end
inner.some_method
end
def some_other_method
@a.foo @b unless c.baz?
end
def some_other_method2
@a.foo @b unless c.baz?
end
def some_other_method3
@a.foo @b unless c.boing?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment