Class: Shortcut

Inherits:
Object
  • Object
show all
Defined in:
lib/shortcut.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, key_seq, description, operating_system) ⇒ Shortcut

Returns a new instance of Shortcut.



6
7
8
9
10
11
# File 'lib/shortcut.rb', line 6

def initialize(name, key_seq, description, operating_system)
	@name = name
	@key_seq = key_seq
	@description = description
	@operating_system = operating_system
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



4
5
6
# File 'lib/shortcut.rb', line 4

def description
  @description
end

#key_seqObject

Returns the value of attribute key_seq.



4
5
6
# File 'lib/shortcut.rb', line 4

def key_seq
  @key_seq
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/shortcut.rb', line 4

def name
  @name
end

#operating_systemObject

Returns the value of attribute operating_system.



4
5
6
# File 'lib/shortcut.rb', line 4

def operating_system
  @operating_system
end

Class Method Details

.allObject



34
35
36
# File 'lib/shortcut.rb', line 34

def self.all
	@@all
end

.create_from_attribute_array(attribute_array) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/shortcut.rb', line 21

def self.create_from_attribute_array(attribute_array)

	operating_system = OperatingSystem.find_or_create_operating_system(attribute_array[3])
	name = attribute_array[0]
	key_seq = attribute_array[1]
	description = attribute_array[2]

	shortcut = Shortcut.new(name, key_seq, description, operating_system)

	shortcut.save
	operating_system.add_shortcut(shortcut)
end

Instance Method Details

#saveObject



17
18
19
# File 'lib/shortcut.rb', line 17

def save
	@@all << self
end