Last active
December 21, 2015 19:39
-
-
Save bdthinh/6355515 to your computer and use it in GitHub Desktop.
def method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def method_name(x1,x2,x3,x4) | |
def method_name(name,mode ='r') | |
def method_name(options) | |
def method_name(*points) | |
def story2(options={}) | |
options = { person: "Yankee Doodle", animal: "Tiger" }.merge(options) | |
"#{options[:person]} went to town, riding on a #{options[:animal]}" | |
end | |
def distance4(*points) | |
x1,y1,x2,y2 = points.flatten | |
raise ArgumentError unless [x1,y1,x2,y2].all? { |e| Numeric === e } | |
Math.hypot(x2 - x1, y2 - y1) | |
end | |
"This is a string".instance_eval do | |
"O hai, can has reverse? #{reverse}. kthxbye" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment