Skip to content

Instantly share code, notes, and snippets.

View BrayanZ's full-sized avatar

Brayan BrayanZ

  • 02:19 (UTC -06:00)
View GitHub Profile
class Employee
def initialize(name, base_salary)
@name = name
@base_salary = base_salary
end
def calculate_net_salary
# business logic about how to calculate the net salary
end
class Employee
def initialize(name, base_salary)
@name = name
@base_salary = base_salary
end
def calculate_net_salary
# business logic about how to calculate the net salary
end
end
class Notification
def initialze(kind, body)
@kind, @body = kind, body
end
def send_sms_notification
# sends a sms notification
end
def send_email_notification
class SMSNotification < Notification
def send
# sends a sms notification
end
end
class EmailNotification < Notification
def send
# sends an email with the notification
end
class Message
attr_reader :status
def initialize
@status = :started
end
def cancel
@status = :canceled
end
class Message
attr_reader :status
def initialize
@status = :started
end
def can_be_cancelled?
return true
end
module Tools
def valid_email? email
# ...
end
def send_email(from, to, message)
#
end
def log(priority, message)
module Tools
module Mailer
def valid_email? email
# ...
end
def send_email(from, to, message)
#
end
end
class Something
def initialize()
@variable = AnotherThing.new
end
end
class Something
def initialize(a_thing)
@variable = a_thing
end
end