-
-
Save theCrab/91787faf5179a63c4199 to your computer and use it in GitHub Desktop.
Pure RUBY PORO to illustrate business logic separation from Frameworks.
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 Company | |
include Address, Owner, Email, PhoneNumber | |
attr_accessor :name, :address, :phone_number, :email, :owner | |
def initialize(name) | |
@name = name | |
@address ||= address #new company address | |
... | |
end | |
end | |
class Vehicle | |
attr_accessor :reg_plate, :make, :model, :date_of_reg, :seat_capacity, :lincese | |
end | |
class Address | |
attr_accessor :line_one, :line_two, :city, :state, :post_code, :company, :owner | |
end | |
class Owner | |
include Address, Company, Email, PhoneNumber | |
attr_accessor :first_name, :last_name, :address, :email, :phone_number | |
def initialize(first_name, last_name) | |
@first_name, @last_name = first_name, last_name | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment