Skip to content

Instantly share code, notes, and snippets.

@Lightpower
Last active December 19, 2015 22:29
Show Gist options
  • Save Lightpower/6027664 to your computer and use it in GitHub Desktop.
Save Lightpower/6027664 to your computer and use it in GitHub Desktop.
Interface
require "interface"
DuckInterface = interface {
required_methods :walk, :swim, :quack
}
class Duck
def walk
puts 'Duck walks'
end
def swim
puts 'Duck swims'
end
def quack
puts 'Duck quacks'
end
implements DuckInterface
end
class PteroDuck
def walk
puts 'PteroDuck walks'
end
def swim
puts 'PteroDuck swims'
end
def quack
puts 'PteroDuck quacks'
end
implements DuckInterface
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment