Class: ConsoleRtm::RtmListRepository
- Inherits:
-
Object
- Object
- ConsoleRtm::RtmListRepository
- Defined in:
- lib/rmilk/rtm_list_repository.rb
Instance Method Summary collapse
- #get_list_id_by_name(name) ⇒ Object
- #get_list_name_by_id(id) ⇒ Object
-
#initialize(context) ⇒ RtmListRepository
constructor
A new instance of RtmListRepository.
Constructor Details
#initialize(context) ⇒ RtmListRepository
Returns a new instance of RtmListRepository.
5 6 7 |
# File 'lib/rmilk/rtm_list_repository.rb', line 5 def initialize(context) @context = context end |
Instance Method Details
#get_list_id_by_name(name) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/rmilk/rtm_list_repository.rb', line 19 def get_list_id_by_name(name) if id = @context.get_list_id(name) then id else list = all_lists.find {|list| list.name == name} return nil if list == nil @context.save_list_name list.list_id, name and return list.list_id end end |
#get_list_name_by_id(id) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/rmilk/rtm_list_repository.rb', line 9 def get_list_name_by_id(id) if n = @context.get_list_name(id) then n else list = all_lists.find {|list| list.list_id == id} return nil if list == nil @context.save_list_name id, list.name and return list.name end end |