rnc_2016 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 964b0822520e752e82ef9d893d141bb714c0f90c
4
+ data.tar.gz: 626e14fb8d0a2b3ef6715cf60c8167712b27945f
5
+ SHA512:
6
+ metadata.gz: 121faebf9fa6441e142b8c38c303650be31c0cd1468af820b292f33195f8a9d3586208b112bad7c33f83b2785fd3f07dd03c8d78ca1cfcaf00648fd72060ccab
7
+ data.tar.gz: 02184e0004aa72cc8efdb04e2d77e382de857b3481eb3d0c20c6af198797f79684f7b09a99d25810f56e3342935733b538bda200c562b0bc6c08e94e0d45357e
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.1
3
+
4
+ Metrics/ClassLength:
5
+ CountComments: false # count full line comments?
6
+ Max: 50
7
+
8
+ Metrics/ModuleLength:
9
+ CountComments: false # count full line comments?
10
+ Max: 50
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.6
4
+ before_install: gem install bundler -v 1.11.2
@@ -0,0 +1,49 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This code of conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at gavin@nationbuilder.com. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
45
+ version 1.3.0, available at
46
+ [http://contributor-covenant.org/version/1/3/0/][version]
47
+
48
+ [homepage]: http://contributor-covenant.org
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rnc_2016.gemspec
4
+ gemspec
5
+
6
+ gem 'pry'
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Gavin DeSchutter
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # rnc-2016
2
+ Delegate modeling for the 2016 Republican National Convention in Cleveland
3
+
4
+ #Goal
5
+
6
+ News articles have detailed the importance of delegate selecton for the 2016 Repulican National Convention. Few have detailed the bounding rules for these delegates and what the rules mean per ballot round for voting at the convetion. This is an effort encapsulate delegate rules in a programmatic, authoritative place.
7
+
8
+ #Pending States & Territories
9
+ - [ ] Add moar soooonnn
10
+
11
+ #Work that is done
12
+ - [x] Install test suite
13
+ - [x] Install a style linter
14
+ - [x] [Model state delegates from NYT Article](http://www.nytimes.com/interactive/2016/04/01/us/politics/how-votes-for-trump-could-become-delegates-for-someone-else.html?_r=0 "How Votes For Drumpf Could
15
+ Become Delegates for Someone Else")
16
+
17
+ #Completed States & Territories
18
+ - [x] Alabama
19
+ - [x] California
20
+ - [x] Florida
21
+ - [x] Hawaii
22
+ - [x] Nevada
23
+ - [x] New York
24
+ - [x] Ohio
25
+ - [x] Pennsylvania
26
+ - [x] Texas
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'rnc_2016'
5
+
6
+ require 'pry'
7
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/config.reek ADDED
@@ -0,0 +1,3 @@
1
+ UncommunicativeModuleName:
2
+ accept:
3
+ - !ruby/regexp /Rnc2016/
@@ -0,0 +1,87 @@
1
+ # http://www.thegreenpapers.com/P16/AL-R
2
+
3
+ # All 50 of Alabama's delegates to the Republican National Convention are
4
+ # allocated to presidential contenders in today's Alabama Presidential Primary.
5
+
6
+ # 21 district delegates are allocated to presidential contenders,
7
+ # "winner-take-most", based on the results of the primary in each congressional
8
+ # district. Each of the 7 congressional districts is assigned 3 National
9
+ # Convention delegates.
10
+
11
+ ## If a candidate receives a majority of the vote (more than 50%) or if only
12
+ ## one candidate receives 20% or more of the vote, that candidate is
13
+ ## allocated all 3 of the district's delegates.
14
+
15
+ ## If no candidate receives a majority of the vote and more than 1 candidate
16
+ ## receives 20% or more of the vote, the candidate with the most votes is
17
+ ## allocated 2 delegates and the candidate with the next highest number of
18
+ ## votes is allocated 1 delegate.
19
+
20
+ ## If no candidate receives 20% of the vote, the 3 district delegates are
21
+ ## proportionally allocated to the presidential contenders. See the rounding
22
+ ## rules below.
23
+
24
+ # 29 (10 at-large, 16 bonus, 3 RNC) at-large delegates are allocated to
25
+ # presidential contenders, "winner-take-most", based on the statewide
26
+ # results of the primary.
27
+
28
+ ## If a candidate receives a majority of the vote (more than 50%) or if only
29
+ ## one candidate receives 20% or more of the vote, that candidate is
30
+ ## allocated all of the 29 at-large delegates.
31
+
32
+ ## If no candidate receives a majority of the vote and more than 1 candidate
33
+ ## receives 20% or more of the vote, the 29 at-large delegates are to be
34
+ ## proportionally allocated to the presidential contenders to those candidates
35
+ ## receiving 20% or more the vote. See the rounding rules below.
36
+
37
+ ## If no candidate receives 20% of the vote, the 29 at-large delegates are
38
+ ## proportionally allocated to the presidential contenders. See the rounding
39
+ ## rules below.
40
+
41
+ ### Rounding Rules ###
42
+ # Proportional allocation rounding: Round the delegate allocations to the
43
+ # nearest whole number. If the rounding allocates too few delegates, the
44
+ # candidate with the most votes receives the remaining delegate(s). If the
45
+ # rounding allocates too many delegates, the candidate who qualified for
46
+ # delegates receiving the fewest votes looses as many delegates as necessary.
47
+
48
+ # In addition, 3 party leaders, the National Committeeman, the National
49
+ # Committeewoman, and the chairman of the Alabama's Republican Party, will
50
+ # attend the convention as pledged delegates by virtue of their position.
51
+
52
+ # No person named as a delegate or alternate delegate pledged to a person as
53
+ # the Republican nominee for President of the United States shall cast a
54
+ # contrary vote at such convention unless first released by (a) public
55
+ # statement or in writing by such presidential candidate or (b) two-thirds vote
56
+ # of all members of the Alabama Delegation to the Republican National
57
+ # Convention similarly pledged; and the vote of any person who attempts to
58
+ # violate the provisions hereof shall not be allowed, but such vote may instead
59
+ # be cast for the person to whom such delegate or alternate delegate is pledged
60
+ # either by the Chairman of the Alabama Delegation to the Republican National
61
+ # Convention or by the Secretary of such Convention.
62
+
63
+ module Rnc2016
64
+ # From NYT Article:
65
+
66
+ # Some states do not unbind delegates after a certain number of ballots.
67
+ # In Alabama, delegates are elected on the primary ballot, listed next
68
+ # to the presidential candidate they support. They must continue to support
69
+ # that candidate at the convention until two-thirds of the delegation votes
70
+ # to change, or until the candidate releases them.
71
+ class AlabamaDelegate
72
+ def initialize(bounded_preference:, personal_preference:, round:, released: false)
73
+ @bounded_preference = bounded_preference.freeze
74
+ @personal_preference = personal_preference.freeze
75
+ @round = round.freeze
76
+ @released = released.freeze
77
+ end
78
+
79
+ def vote
80
+ if @released
81
+ @personal_preference
82
+ else
83
+ @bounded_preference
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,55 @@
1
+ # http://www.thegreenpapers.com/P16/CA-R
2
+
3
+ # 159 district delegates are to be bound to presidential
4
+ # contenders based on the primary results in each of the
5
+ # 53 congressional districts: each congressional district
6
+ # is assigned 3 National Convention delegates and the
7
+ # presidential contender receiving the greatest number of
8
+ # votes in that district will receive all 3 of that
9
+ # district's National Convention delegates.
10
+
11
+ # 13 at-large delegates (10 base at-large delegates plus 0
12
+ # bonus delegates plus 3 RNC delegates) are to be bound to
13
+ # the presidential contender receiving the greatest number
14
+ # of votes in the primary statewide.
15
+
16
+ ### [California Elections Code Section 6461.(c)] ###
17
+
18
+ # Each delegate to the Republican National Convention
19
+ # shall use his or her best efforts at the convention
20
+ # for the party's presidential nominee candidate from
21
+ # California to whom the delegate has pledged support
22
+ # until the person is nominated for the office of President
23
+ # of the United States by the convention, receives less than
24
+ # 10 percent of the votes for nomination by the convention,
25
+ # releases the delegate from his or her obligation, or
26
+ # until two convention nominating ballots have been taken.
27
+ # Thereafter, each delegate shall be free to vote as he or she chooses....
28
+
29
+ module Rnc2016
30
+ # From NYT Article:
31
+
32
+ # In a handful of states like California,
33
+ # which holds its primary on June 7,
34
+ # candidates handpick their delegates to the convention,
35
+ # making it more likely that they will stay true
36
+ # to the voters' wishes even when they are unbound
37
+ # (for Californians, this occurs after the second ballot).
38
+ class CaliforniaDelegate
39
+ def initialize(bounded_preference:, personal_preference:, round:)
40
+ @bounded_preference = bounded_preference.freeze
41
+ @personal_preference = personal_preference.freeze
42
+ @round = round.freeze
43
+ end
44
+
45
+ def vote
46
+ @round < round_released ? @bounded_preference : @personal_preference
47
+ end
48
+
49
+ private
50
+
51
+ def round_released
52
+ 3
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,47 @@
1
+ # http://www.thegreenpapers.com/P16/FL-R
2
+
3
+ # Tuesday 15 March 2016 Primary:
4
+ # All 99 of Florida's delegates to the Republican National Convention are
5
+ # allocated in today's Florida Presidential Primary.
6
+ # [Republican Party of Florida Rule 10 B. and D]
7
+
8
+ # The Republican presidential candidate receiving the highest number of
9
+ # statewide votes at the Florida Presidential Preference Primary shall be
10
+ # awarded all delegates (including the 3 party leaders, the National
11
+ # Committeeman, the National Committeewoman, and the chairman of the Florida's
12
+ # Republican Party) to the Republican National Convention.
13
+
14
+ # National Convention Delegates are bound through the 3rd ballot unless the
15
+ # candidate withdraws or releases his/her delegates. "The Chairman ... shall
16
+ # be bound to ... cast all Delegate at Large votes ... during the first three
17
+ # convention ballots .... If the candidate... releases the delegates or]
18
+ # withdraws his or her candidacy, then said delegate votes will not be bound
19
+ # to any candidate. [Republican Party of Florida Rule 10 B.]
20
+
21
+ module Rnc2016
22
+ # Florida is a winnter-take-all state with delegates bounded until the 4th
23
+ # round. They can vote for personal preference if released by candidate
24
+ # before 4th round.
25
+ class FloridaDelegate
26
+ def initialize(bounded_preference:, personal_preference:, round:, released: false)
27
+ @bounded_preference = bounded_preference.freeze
28
+ @personal_preference = personal_preference.freeze
29
+ @round = round.freeze
30
+ @released = released.freeze
31
+ end
32
+
33
+ def vote
34
+ if @released || @round >= round_released
35
+ @personal_preference
36
+ else
37
+ @bounded_preference
38
+ end
39
+ end
40
+
41
+ private
42
+
43
+ def round_released
44
+ 4
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,32 @@
1
+ # http://www.thegreenpapers.com/P16/HI-R
2
+
3
+ module Rnc2016
4
+ # Section 216. CANDIDATE COMMITMENTS. Except by their own commitments,
5
+ # National Delegates ... shall not be required to support any particular
6
+ # candidate for the Republican nomination for President or Vice President.
7
+ # Provided the candidate the delegate ... is supporting has not withdrawn
8
+ # prior to the first ballot at the National Convention, the commitment to
9
+ # that candidate shall be binding, but only through the first ballot.
10
+ class HawaiiDelegate
11
+ def initialize(bounded_preference:, personal_preference:, round:, released: false)
12
+ @bounded_preference = bounded_preference.freeze
13
+ @personal_preference = personal_preference.freeze
14
+ @round = round.freeze
15
+ @released = released.freeze
16
+ end
17
+
18
+ def vote
19
+ if @released || @round >= round_released
20
+ @personal_preference
21
+ else
22
+ @bounded_preference
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ def round_released
29
+ 2
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,38 @@
1
+ # http://www.thegreenpapers.com/P16/NV-R
2
+
3
+ module Rnc2016
4
+ # Nevada's delegates are bound for the 1st ballot at the National Convention
5
+ # [Standing Rules 5.1]. National Delegates bound to any candidate who
6
+ # withdraws, suspends, or otherwise discontinues their campaign at any time
7
+ # following the Nevada Republican Convention but prior to the Republican
8
+ # National Convention are released from their commitment
9
+ # [Standing Rules 5.4]. Presidential candidates may elect to either affirm
10
+ # the binding of their delegates, release the binding obligation, or
11
+ # proportionally reallocate their delegates to the remaining candidates based
12
+ # on the results of the Presidential Preference Poll [Standing Rules 5.3].
13
+
14
+ # If one candidate wins all of the National Delegates, the chairman will
15
+ # attend the National Convention unbound [Standing Rules 5.2].
16
+ class NevadaDelegate
17
+ def initialize(bounded_preference:, personal_preference:, round:, released: false)
18
+ @bounded_preference = bounded_preference.freeze
19
+ @personal_preference = personal_preference.freeze
20
+ @round = round.freeze
21
+ @released = released.freeze
22
+ end
23
+
24
+ def vote
25
+ if @released || @round >= round_released
26
+ @personal_preference
27
+ else
28
+ @bounded_preference
29
+ end
30
+ end
31
+
32
+ private
33
+
34
+ def round_released
35
+ 2
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,28 @@
1
+ # http://www.thegreenpapers.com/P16/NY-R
2
+
3
+ module Rnc2016
4
+ # Delegates are bound for the 1st ballot at the Republican National
5
+ # Convention unless released by the candidate.
6
+ class NewYorkDelegate
7
+ def initialize(bounded_preference:, personal_preference:, round:, released: false)
8
+ @bounded_preference = bounded_preference.freeze
9
+ @personal_preference = personal_preference.freeze
10
+ @round = round.freeze
11
+ @released = released.freeze
12
+ end
13
+
14
+ def vote
15
+ if @released || @round >= round_released
16
+ @personal_preference
17
+ else
18
+ @bounded_preference
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def round_released
25
+ 2
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,27 @@
1
+ # http://www.thegreenpapers.com/P16/OH-R
2
+
3
+ module Rnc2016
4
+ # Ohio is murky on how long it binds delegates. It looks as though delegates
5
+ # are bound indefinitely. Building this class under that assumption until
6
+ # evidence proves the contrary.
7
+ # http://frontloading.blogspot.com/2016/03/2016-republican-delegate-allocation-ohio.html
8
+
9
+ # Article X, Section 1(d) of Ohio Republican Party as of 2016-04-09:
10
+ # The winner of the 2016 Ohio Presidential Primary shall be awarded all 66
11
+ # delegates and 63 alternates to the Republican National Convention whether
12
+ # the delegates are at-large or awarded by Congressional district.
13
+
14
+ # Rather non specific on binding, no?
15
+ class OhioDelegate
16
+ def initialize(bounded_preference:, personal_preference:, round:, released: false)
17
+ @bounded_preference = bounded_preference.freeze
18
+ @personal_preference = personal_preference.freeze
19
+ @round = round.freeze
20
+ @released = released.freeze
21
+ end
22
+
23
+ def vote
24
+ @bounded_preference
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,60 @@
1
+ # http://www.thegreenpapers.com/P16/PA-R
2
+
3
+ # 54 of the Commonwealth's 71 delegates to the Republican National Convention
4
+ # will be directly elected (their names appear on the ballot) in a LOOPHOLE
5
+ # type primary, in which delegates are elected separately from a presidential
6
+ # preference. Each of the 18 Congressional District is allocated 3 delegates
7
+ # (54 = 18 districts X 3 delegates/district). Rule 8.4 of the Republican State
8
+ # Committee of Pennsylvania's Rules states that all delegates elected by
9
+ # Congressional District "...shall run at large within the Districts and shall
10
+ # not be officially committed to any particular candidate on the ballot.".
11
+
12
+ # 17 (10 base at-large delegates plus 4 bonus delegates plus 3 RNC delegates)
13
+ # of the Commonwealth's 71 delegates to the Republican National Convention
14
+ # delegates are bound for the 1st ballot to the candidate who receives the most
15
+ # votes in the Pennsylvania Presidential Primary. The delegates are released if
16
+ # the candidate withdraws, suspends, or terminates his/her campaign or publicly
17
+ # releases his/her delegates. [Rule 8.3]
18
+
19
+ module Rnc2016
20
+ # From NYT Article:
21
+
22
+ # Roughly five percent of delegates will go into the convention free to vote
23
+ # as they please, including 54 from Pennsylvania.
24
+ class PennsylvaniaDelegate
25
+ def initialize(bounded_preference:, personal_preference:, round:, released: false)
26
+ @bounded_preference = bounded_preference.freeze
27
+ @personal_preference = personal_preference.freeze
28
+ @round = round.freeze
29
+ @released = released.freeze
30
+ end
31
+
32
+ def vote
33
+ @personal_preference
34
+ end
35
+ end
36
+
37
+ # This class is for the delegates assigned based upon popular vote results.
38
+ class PennsylvaniaBoundedDelegate
39
+ def initialize(bounded_preference:, personal_preference:, round:, released: false)
40
+ @bounded_preference = bounded_preference.freeze
41
+ @personal_preference = personal_preference.freeze
42
+ @round = round.freeze
43
+ @released = released.freeze
44
+ end
45
+
46
+ def vote
47
+ if @released || @round >= round_released
48
+ @personal_preference
49
+ else
50
+ @bounded_preference
51
+ end
52
+ end
53
+
54
+ private
55
+
56
+ def round_released
57
+ 2
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,63 @@
1
+ # http://www.thegreenpapers.com/P16/TX-R
2
+
3
+ # Thursday 12 May - Saturday 14 May 2016:
4
+
5
+ # The Texas Republican State Convention convenes in Dallas.
6
+ # The National Convention delegates are elected on the according
7
+ # to the results of the primary on the last day of the convention.
8
+ # [General Rules for All Conventions and Meetings. Rule 38.]
9
+
10
+ # 108 district delegates are elected:
11
+ # 3 from each of the state's 36 congressional districts.
12
+
13
+ # 44 at-large delegates (10 base at-large delegates
14
+ # plus 34 bonus delegates) are elected.
15
+
16
+ # The 3 party leaders, the National Committeeman, the National Committeewoman,
17
+ # and the chairman of the Texas's Republican Party,
18
+ # will attend the convention as pledged delegates by virtue of their position.
19
+
20
+ # National Convention delegates are:
21
+
22
+ ## - bound for the 1st ballot unless "released from the pledge only in the
23
+ ## event of death, withdrawal, or by decision of the candidate".
24
+ ## [Section 10.b.1]
25
+ ## - bound for the 2nd ballot unless "released from the pledge if the
26
+ ## candidate has failed to receive 20% or more of the total vote ...
27
+ ## or by decision of the candidate.". [Section 10.b.2.]
28
+ ## - released for the 3rd and subsequent ballots. [Section 10.b.3]
29
+
30
+ module Rnc2016
31
+ # From NYT Article:
32
+
33
+ # In several states, including Texas,
34
+ # at least some delegates are elected through
35
+ # local caucuses and at the state convention.
36
+ # In Texas, the presidential candidates run what
37
+ # the state party's assistant general counsel
38
+ # described as "36 separate mini-campaigns" in
39
+ # the state's congressional districts to get
40
+ # their supporters elected.
41
+ class TexasDelegate
42
+ def initialize(bounded_preference:, personal_preference:, round:, released: false)
43
+ @bounded_preference = bounded_preference.freeze
44
+ @personal_preference = personal_preference.freeze
45
+ @round = round.freeze
46
+ @released = released.freeze
47
+ end
48
+
49
+ def vote
50
+ if @released || @round >= round_released
51
+ @personal_preference
52
+ else
53
+ @bounded_preference
54
+ end
55
+ end
56
+
57
+ private
58
+
59
+ def round_released
60
+ 3
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,3 @@
1
+ module Rnc2016
2
+ VERSION = '0.1.1'.freeze
3
+ end
data/lib/rnc_2016.rb ADDED
@@ -0,0 +1,24 @@
1
+ require 'rnc_2016/version'
2
+ require 'rnc_2016/alabama_delegate'
3
+ require 'rnc_2016/california_delegate'
4
+ require 'rnc_2016/florida_delegate'
5
+ require 'rnc_2016/hawaii_delegate'
6
+ require 'rnc_2016/nevada_delegate'
7
+ require 'rnc_2016/new_york_delegate'
8
+ require 'rnc_2016/ohio_delegate'
9
+ require 'rnc_2016/pennsylvania_delegate'
10
+ require 'rnc_2016/texas_delegate'
11
+
12
+ # Namespace to rule all namespaces
13
+ module Rnc2016
14
+ # https://gop.com/convention-facts/?convention_type=how
15
+
16
+ # If a candidate receives 1,237 delegates
17
+ # or more on the first round of voting,
18
+ # he or she wins the nomination.
19
+
20
+ # If no candidate reaches a majority,
21
+ # rounds of voting will occur until a candidate does.
22
+
23
+ VOTES_REQUIRED_FOR_NOMINATION = 1237
24
+ end
data/rnc_2016.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rnc_2016/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'rnc_2016'
8
+ spec.version = Rnc2016::VERSION
9
+ spec.authors = ["Gavin 'Everyteen' DeSchutter"]
10
+ spec.email = ['gavin.deschutter@mac.com']
11
+
12
+ spec.summary = 'Delegate modeling for the 2016 Republican ' \
13
+ 'National Convention in Cleveland'
14
+ spec.description = "News articles have detailed why delegate \
15
+ selecton and use is crucial for the 2016 \
16
+ Repulican National Convention. Few have \
17
+ detailed the how it happens and what it \
18
+ means for voting at the convetion. This \
19
+ is an effort encapsulate delegate rules \
20
+ in a programmatic, authoritative place."
21
+ spec.homepage = 'https://github.com/gavindeschutter/rnc_2016'
22
+
23
+ spec.files = `git ls-files -z`.split("\x0")
24
+ .reject{ |f|
25
+ f.match(%r{^(test|spec|features)/})
26
+ }
27
+ spec.bindir = 'exe'
28
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
+ spec.require_paths = ['lib']
30
+
31
+ spec.add_development_dependency 'bundler', '~> 1.11'
32
+ spec.add_development_dependency 'rake', '~> 10.0'
33
+ spec.add_development_dependency 'rspec', '~> 3.0'
34
+ spec.add_development_dependency 'rubocop'
35
+ spec.add_development_dependency 'reek'
36
+ end
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rnc_2016
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Gavin 'Everyteen' DeSchutter
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-04-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.11'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.11'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: reek
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: News articles have detailed why delegate selecton
84
+ and use is crucial for the 2016 Repulican National Convention.
85
+ Few have detailed the how it happens and what it means
86
+ for voting at the convetion. This is an effort encapsulate
87
+ delegate rules in a programmatic, authoritative place.
88
+ email:
89
+ - gavin.deschutter@mac.com
90
+ executables: []
91
+ extensions: []
92
+ extra_rdoc_files: []
93
+ files:
94
+ - ".gitignore"
95
+ - ".rspec"
96
+ - ".rubocop.yml"
97
+ - ".travis.yml"
98
+ - CODE_OF_CONDUCT.md
99
+ - Gemfile
100
+ - LICENSE
101
+ - README.md
102
+ - Rakefile
103
+ - bin/console
104
+ - bin/setup
105
+ - config.reek
106
+ - lib/rnc_2016.rb
107
+ - lib/rnc_2016/alabama_delegate.rb
108
+ - lib/rnc_2016/california_delegate.rb
109
+ - lib/rnc_2016/florida_delegate.rb
110
+ - lib/rnc_2016/hawaii_delegate.rb
111
+ - lib/rnc_2016/nevada_delegate.rb
112
+ - lib/rnc_2016/new_york_delegate.rb
113
+ - lib/rnc_2016/ohio_delegate.rb
114
+ - lib/rnc_2016/pennsylvania_delegate.rb
115
+ - lib/rnc_2016/texas_delegate.rb
116
+ - lib/rnc_2016/version.rb
117
+ - rnc_2016.gemspec
118
+ homepage: https://github.com/gavindeschutter/rnc_2016
119
+ licenses: []
120
+ metadata: {}
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubyforge_project:
137
+ rubygems_version: 2.4.8
138
+ signing_key:
139
+ specification_version: 4
140
+ summary: Delegate modeling for the 2016 Republican National Convention in Cleveland
141
+ test_files: []