Class: Pal
- Inherits:
-
Object
show all
- Defined in:
- lib/sw_info.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(data) ⇒ Pal
Returns a new instance of Pal.
59
60
61
|
# File 'lib/sw_info.rb', line 59
def initialize(data)
@data = data
end
|
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
25
26
27
|
# File 'lib/sw_info.rb', line 25
def data
@data
end
|
Class Method Details
.all ⇒ Object
43
44
45
|
# File 'lib/sw_info.rb', line 43
def self.all
end
|
.find(id) ⇒ Object
39
40
41
|
# File 'lib/sw_info.rb', line 39
def self.find(id)
end
|
.search_for_all(key) ⇒ Object
47
48
49
50
|
# File 'lib/sw_info.rb', line 47
def self.search_for_all(key)
variable = DATA[key].map {|p| new(p)}
return variable
end
|
.search_for_id(key, id) ⇒ Object
52
53
54
55
56
57
|
# File 'lib/sw_info.rb', line 52
def self.search_for_id(key, id)
variable = DATA[key].find do |p|
p["id"] == id
end
return new(variable)
end
|
Instance Method Details
#id ⇒ Object
31
32
33
|
# File 'lib/sw_info.rb', line 31
def id
@data['id']
end
|
#name ⇒ Object
35
36
37
|
# File 'lib/sw_info.rb', line 35
def name
@data['name']
end
|
#to_s ⇒ Object
27
28
29
|
# File 'lib/sw_info.rb', line 27
def to_s
name
end
|