Skip to content

Instantly share code, notes, and snippets.

@shunwen shunwen/snippet.rb
Created May 7, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.