Will Engler
> rails console
> 2.days.ago
=> Sat, 28 Feb 2015 22:31:59 UTC +00:00
1.month.from_now
=> Thu, 02 Apr 2015 22:32:24 UTC +00:00
Rails.application.routes.draw do
resources :cats
root 'cats#index'
public int add(int a, int b){
return a + b
}
public String add(String a, String b){
return a + b
}
def add(a, b)
a + b
end
If it walks like a duck...
duck typing is a style of typing in which an object's methods and properties determine the valid semantics, rather than its inheritance from a particular class or implementation of an explicit interface
-Wikipedia
#Ruby
> 2.respond_to?(:+)
=> true
#Python
def is_leaf(node):
try:
if tree.label:
return True
except AttributeError:
return False