Class: YamWow::TopicsResponder
- Inherits:
-
Object
- Object
- YamWow::TopicsResponder
- Defined in:
- lib/yamwow/topics_responder.rb
Instance Method Summary collapse
Instance Method Details
#create_response(topics) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/yamwow/topics_responder.rb', line 6 def create_response(topics) @topics = topics remove_duplicates sort_by_name Response.new @topics end |
#remove_duplicates ⇒ Object
13 14 15 |
# File 'lib/yamwow/topics_responder.rb', line 13 def remove_duplicates @topics.uniq! { |t| t['id'] } end |
#sort_by_name ⇒ Object
17 18 19 |
# File 'lib/yamwow/topics_responder.rb', line 17 def sort_by_name @topics.sort! { |x, y| x['full_name'].to_s.downcase <=> y['full_name'].to_s.downcase } end |