Skip to content

Instantly share code, notes, and snippets.

@shunwen
Created May 7, 2018 14:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shunwen/be6ae7019a71593c070fa57ab703992b to your computer and use it in GitHub Desktop.
Save shunwen/be6ae7019a71593c070fa57ab703992b to your computer and use it in GitHub Desktop.
def foo
some_function(true, { :before => {a: 1},
:after => {b: 2} })
call_block { do_something }
end
def bar
case @var
when 1
print [1..42]
else
print [1...42]
end
end
A = [1, [2, [3] ] ]
private
def foobar(p1: nil,
p2: true,
p3: nil)
a = p1 == p2
p2 =~ /something/
p3 = ( (p1) + p2 )
end
foobar(p1: "",
p2: false,
p3: 1)
def foo
'ba' +
'r'
end
what_is_foo = case foo
when 'baz'
'foo is baz'
when 'bar'
'foo is bar'
else
'foo is strange'
end
return if foo?
class Example
def public1
end
private
def private1
end
protected
def protected1
end
public
def public2
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment