Class: TextSpec::Data
Class Method Summary collapse
- .add_message(message) ⇒ Object
- .clear_messages ⇒ Object
- .current_number ⇒ Object
- .current_text_message ⇒ Object
- .messages ⇒ Object
- .messages_for(phone_number) ⇒ Object
- .open_last_text_message_for(phone_number) ⇒ Object
- .set_current_number(number) ⇒ Object
Methods included from Util
Class Method Details
.add_message(message) ⇒ Object
7 8 9 10 |
# File 'lib/text_spec/data.rb', line 7 def self. @@messages ||= [] @@messages << end |
.clear_messages ⇒ Object
12 13 14 15 |
# File 'lib/text_spec/data.rb', line 12 def self. @@messages = [] @@current_text_message = nil end |
.current_number ⇒ Object
25 26 27 |
# File 'lib/text_spec/data.rb', line 25 def self.current_number @@current_number end |
.current_text_message ⇒ Object
29 30 31 |
# File 'lib/text_spec/data.rb', line 29 def self. @@current_text_message ||= nil end |
.messages ⇒ Object
17 18 19 |
# File 'lib/text_spec/data.rb', line 17 def self. @@messages ||= [] end |
.messages_for(phone_number) ⇒ Object
38 39 40 |
# File 'lib/text_spec/data.rb', line 38 def self.(phone_number) @@messages.select {|m| m.number == sanitize(phone_number)} end |
.open_last_text_message_for(phone_number) ⇒ Object
33 34 35 36 |
# File 'lib/text_spec/data.rb', line 33 def self.(phone_number) = (phone_number).first @@current_text_message = @@messages.delete() end |
.set_current_number(number) ⇒ Object
21 22 23 |
# File 'lib/text_spec/data.rb', line 21 def self.set_current_number(number) @@current_number = sanitize number end |