This file contains hidden or 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
"Disable arrows | |
map <up> <nop> | |
map <down> <nop> | |
map <left> <nop> | |
map <right> <nop> | |
imap <up> <nop> | |
imap <down> <nop> | |
imap <left> <nop> | |
imap <right> <nop> |
This file contains hidden or 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
class EvenMoreAccessControlExamples | |
def public_by_default | |
end | |
def protected_method | |
end | |
def this_is_public_too | |
end | |
This file contains hidden or 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
class MoreAccessControlExamples | |
def public_by_default | |
end | |
protected def protected_method | |
end | |
public def this_is_public_too | |
end | |
This file contains hidden or 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
class AccessControlExamples | |
def public_method_by_default | |
end | |
protected | |
def first_protected_method | |
end | |
def second_protected_method | |
end | |
This file contains hidden or 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
class ComputerBrand | |
include Comparable | |
attr_reader :name | |
def initialize(name) | |
@name = name | |
end | |
def <=>(other) |
This file contains hidden or 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
module ModuleExample | |
def self.hello_world | |
puts 'This is a static hello world from a module' | |
end | |
def hello_world | |
puts 'This is a non static hello world from a module' | |
end | |
end |
This file contains hidden or 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
module AModule | |
class String | |
def i_like_open_classes | |
puts "#{self} hasn't been monkey patched" | |
end | |
end | |
end | |
string = String.new | |
begin |
This file contains hidden or 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
class MyClass | |
CONSTANT = 'hello world' | |
end | |
puts MyClass::CONSTANT | |
begin | |
puts MyClass.CONSTANT | |
rescue NoMethodError | |
puts 'With dot notation we are sending a message to class MyClass' |
This file contains hidden or 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
module ModuleExample | |
def self.hello_world | |
puts 'This is a static hello world from a module' | |
end | |
def hello_world | |
puts 'This is a non static hello world from a module' | |
end | |
end |
This file contains hidden or 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
class Roll | |
FIFTY_POINTS = 50 | |
HUNDRED_POINTS = 100 | |
THOUSAND_POINTS = 1000 | |
def initialize(rolls) | |
@ocurrences = ocurrences_of_each_number(rolls) | |
end | |
def score |