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|
13
13
s . description = ""
14
14
15
15
s . add_dependency ( 'rest-client' )
16
+ s . add_dependency ( 'hashie' )
16
17
s . add_dependency ( 'yajl-ruby' )
17
18
18
19
# Because I just don't want to live without some of it..
Original file line number Diff line number Diff line change 1
1
module ESDB
2
2
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
+
3
21
# Combines all entities into a hash keys with the team number
4
22
def teams
5
23
entities . inject ( { } ) { |teams , entity |
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ def self.config
20
20
end
21
21
22
22
require 'rest_client'
23
+ require 'hashie/mash'
23
24
require 'active_support/inflector'
24
25
require 'yajl'
25
26
require 'yajl/json_gem'
You can’t perform that action at this time.
0 commit comments