Class: SMS::Person
- Inherits:
-
Hash
- Object
- Hash
- SMS::Person
- Defined in:
- lib/rubysms/person.rb
Constant Summary collapse
- @@people =
{}
Instance Attribute Summary collapse
-
#backend ⇒ Object
readonly
Returns the value of attribute backend.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(backend, key) ⇒ Person
constructor
A new instance of Person.
-
#phone_number ⇒ Object
wat.
-
#to_s ⇒ Object
Return this person is a vaguely useful way that doesn’t look too out of place.
Constructor Details
#initialize(backend, key) ⇒ Person
Returns a new instance of Person.
31 32 33 34 |
# File 'lib/rubysms/person.rb', line 31 def initialize(backend, key) @backend = backend @key = key end |
Instance Attribute Details
#backend ⇒ Object (readonly)
Returns the value of attribute backend.
29 30 31 |
# File 'lib/rubysms/person.rb', line 29 def backend @backend end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
29 30 31 |
# File 'lib/rubysms/person.rb', line 29 def key @key end |
Class Method Details
.fetch(backend, key) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rubysms/person.rb', line 8 def self.fetch(backend, key) # if a people hash doesn't exist for # this backend yet, create one now unless @@people.has_key?(backend) @@people[backend] = {} end # if a person object doesn't already exist for this key, # create one (to be fetched again next time around) unless @@people[backend].has_key?(key) p = SMS::Person.new(backend, key) @@people[backend][key] = p end # return the persistant person, # which may or may not be new @@people[backend][key] end |
Instance Method Details
#phone_number ⇒ Object
wat
43 44 45 |
# File 'lib/rubysms/person.rb', line 43 def phone_number key end |
#to_s ⇒ Object
Return this person is a vaguely useful way that doesn’t look too out of place.
38 39 40 |
# File 'lib/rubysms/person.rb', line 38 def to_s "#<SMS::Person backend=#{backend.label}, key=#{key}>" end |