Class: SmartphoneFinder::Device

Inherits:
Object
  • Object
show all
Extended by:
HelperMethods
Includes:
HelperMethods
Defined in:
lib/smartphone_finder/device.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HelperMethods

list_all, obj_exist?

Constructor Details

#initialize(name, url, brand = nil) ⇒ Device

Returns a new instance of Device.



8
9
10
11
12
13
14
15
16
# File 'lib/smartphone_finder/device.rb', line 8

def initialize(name,url,brand=nil)
  @specifications=nil
     @name=name
     @url=url
     @brand=brand
     if ! obj_exist?
       @@all.push(self)
     end
end

Instance Attribute Details

#brandObject

Returns the value of attribute brand.



7
8
9
# File 'lib/smartphone_finder/device.rb', line 7

def brand
  @brand
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/smartphone_finder/device.rb', line 7

def name
  @name
end

#specificationsObject

Returns the value of attribute specifications.



7
8
9
# File 'lib/smartphone_finder/device.rb', line 7

def specifications
  @specifications
end

#urlObject

Returns the value of attribute url.



7
8
9
# File 'lib/smartphone_finder/device.rb', line 7

def url
  @url
end

Class Method Details

.allObject



18
19
20
# File 'lib/smartphone_finder/device.rb', line 18

def self.all
  @@all 
end