Skip to content

Commit

Permalink
Remove all Helper methods
Browse files Browse the repository at this point in the history
  • Loading branch information
tmtmtmtm committed Apr 6, 2015
1 parent a354f39 commit 741f154
Showing 1 changed file with 7 additions and 39 deletions.
46 changes: 7 additions & 39 deletions lib/popolo_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module Popolo

require 'date'

class Data

def initialize(file)
Expand Down Expand Up @@ -35,6 +37,11 @@ def terms
legislature['terms']
end

def legislative_memberships
# TODO expand!
memberships.find_all { |m| m['organization_id'] == 'legislature' }
end


def term_from_id(id)
terms.detect { |t| t['id'] == id } || terms.detect { |t| t['id'].end_with? "/#{id}" }
Expand Down Expand Up @@ -78,45 +85,6 @@ def party_memberships(id)

module Helper

require 'date'

def popit_data(file='eduskunta')
@_data ||= {}
@_data[file] ||= Popolo::Data.new(file).json
end

def persons
popit_data['persons']
end

def organizations
popit_data['organizations']
end

def parties
popit_data['organizations'].find_all { |o| o['classification'] == 'party' }
end

def legislature
# TODO cope with more than one!
popit_data['organizations'].find { |o| o['classification'] == 'legislature' }
end

def terms
legislature['terms']
end

def memberships
popit_data['memberships']
end

def legislative_memberships
# TODO expand!
memberships.find_all { |m| m['organization_id'] == 'legislature' }
end

end
end



0 comments on commit 741f154

Please sign in to comment.