File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed
Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ Gem::Specification.new do |s|
1313 s . description = ""
1414
1515 s . add_dependency ( 'rest-client' )
16+ s . add_dependency ( 'hashie' )
1617 s . add_dependency ( 'yajl-ruby' )
1718
1819 # Because I just don't want to live without some of it..
Original file line number Diff line number Diff line change 11module ESDB
22 class Match < ESDB ::Resource
3+ # HAX
4+ # Does the match have any summary data?
5+ def summaries?
6+ hash = self . to_hash
7+ if hash [ 'entities' ] . any?
8+ summaries = hash [ 'entities' ] . collect { |e | e [ 'summary' ] }
9+ return summaries . reject { |s | s . empty? || s . nil? } . any?
10+ end
11+ false
12+ end
13+
14+ # TODO: when there is ample time, I want to generalize stuff like this via
15+ # something like Hashie, but Hashie::Mash just didn't work out right away
16+ # it's complicated.. the fact that we have a key called "map" alone..
17+ def map
18+ Hashie ::Mash . new ( self . to_hash [ 'map' ] )
19+ end
20+
321 # Combines all entities into a hash keys with the team number
422 def teams
523 entities . inject ( { } ) { |teams , entity |
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ def self.config
2020end
2121
2222require 'rest_client'
23+ require 'hashie/mash'
2324require 'active_support/inflector'
2425require 'yajl'
2526require 'yajl/json_gem'
You can’t perform that action at this time.
0 commit comments