Last active
July 19, 2017 23:47
-
-
Save rebelweb/198b0e8a1e6d5f508bde25797f64bf65 to your computer and use it in GitHub Desktop.
Basic Object
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 NotificationType | |
attr_accessor :id, :load_id | |
def initialize(id, load_id) | |
self.id = id | |
self.load_id = load_id | |
check_valid_id | |
end | |
def description | |
format(statuses[id], load_id) | |
end | |
private | |
def statuses | |
['Description A - %s', | |
'Description B - %s', | |
'Description C - %s', | |
'Description D - %s', | |
'Description E - %s'] | |
end | |
def check_valid_id | |
return if id.instance_of?(Integer) && id >= 0 && id <= 9 | |
raise 'Invalid Notification Type Id' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment