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
class ClassMethodDemo | |
def self.greet | |
puts "Hello, Ruby" | |
end | |
end | |
ClassMethodDemo.greet |
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
class ClassMethodDemo | |
def self.greet | |
puts "Hello, Ruby" | |
end | |
ClassMethodDemo.greet | |
end |
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
class ClassMethodDemo | |
def self.greet | |
puts "Hello, Ruby" | |
end | |
greet | |
end |
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
class ClassMethodDemo | |
def self.greet | |
puts "Hello, Ruby" | |
end | |
end | |
class UseDemo < ClassMethodDemo | |
greet | |
end |
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
module Aa | |
def a_foo | |
puts "A's foo" | |
end | |
end | |
module Bb | |
def b_foo | |
puts "B's foo" | |
end |
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
class Mammal | |
def breathe | |
puts "inhale and exhale" | |
end | |
end | |
class Cat < Mammal | |
def speak | |
puts "Meow" | |
end |
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
class SelfDemo | |
def foo(val) | |
@value = val | |
bar | |
end | |
def bar | |
puts @value | |
end | |
end |
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 lambda_test | |
lam = lambda { return } | |
lam.call | |
puts "Hello world" | |
end | |
puts "Lambda Test : #{lambda_test }" | |
def proc_test | |
proc = Proc.new { return } |
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
class Fixnum | |
def hours | |
self * 3600 | |
end | |
def from_now | |
Time.now + self | |
end | |
end |
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
RUBY_EXPERIENCE_POINT = 50 | |
# Student Class | |
class Student | |
KNOWLEDGE_TARGET = 75 # 75 percentage of cencepts | |
DEFAULT_EXPERIENCE_PERCENT = 10 | |
attr_accessor :enthusiastic, :class_details | |
def initialize(ruby_experience, enthusiastic) |
OlderNewer