Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module LocalRepository
- class LocalItem
- attr_reader :name, :description, :price, :email, :image
- attr_accessor :id
- def initialize(item_details)
- @name = item_details[:name]
- @description = item_details[:description]
- @price = item_details[:price]
- @email = item_details[:email]
- @image = item_details[:image]
- @id = item_details[:id]
- end
- def save
- if self.valid?
- self
- else
- false
- end
- end
- def valid?
- @id !=nil && @name != nil && @description != nil && @price != nil && @email != nil
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement