Module: WWDC::Helpers
- Includes:
- Gem::Text
- Defined in:
- lib/wwdc/helpers.rb
Instance Method Summary collapse
Instance Method Details
#describe(*sessions) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/wwdc/helpers.rb', line 20 def describe(*sessions) enable_paging if sessions.length > 5 sessions.each do |session| puts %{\033[1mWWDC #{session['year']}\033[0m} puts %{\033[1mSession #{session['number']}: "#{session['title']}"\033[0m} puts puts format_text(session['description'], 80) puts end end |
#get(options = {}) {|response| ... } ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/wwdc/helpers.rb', line 11 def get( = {}, &block) response = client.get() say_error "Error #{response.status}" and abort unless response.status == 200 yield response if block_given? JSON.parse(response.body) end |