chapmanchri_quotemachine2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6576c7f1ef6b45b66d4aa6bafbd59ad9a3b0b3595af4d7232bbca10b60e8bffc
4
+ data.tar.gz: c7d9d329b784930163de20aef98e23350bd992cd0b7c430f5aeb45972de95144
5
+ SHA512:
6
+ metadata.gz: 140c6efbfe1656c64820d3b1a359bed483b758c13276a2fa6d0b131518d0e6d2bb7a17aafe9c6b056d6288408404ebc2d9f1f0265dfe4dc3f8c9d8039132e316
7
+ data.tar.gz: e1f03ba5e1df4e82385892bc28d9323bc5c06449732c16705a7cf99adb663053c57e67cd0ece34b1fc5cb9fb77710b2ccc3c298afbf69817a6d6288b6e651712
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.3
7
+ before_install: gem install bundler -v 1.17.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at TODO: Write your email address. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in chapmanchri_quotemachine2.gemspec
6
+ gemspec
7
+
8
+ gem 'minitest-reporters', '1.2.0'
data/Gemfile.lock ADDED
@@ -0,0 +1,31 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ chapmanchri_quotemachine2 (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ansi (1.5.0)
10
+ builder (3.2.3)
11
+ minitest (5.13.0)
12
+ minitest-reporters (1.2.0)
13
+ ansi
14
+ builder
15
+ minitest (>= 5.0)
16
+ ruby-progressbar
17
+ rake (10.5.0)
18
+ ruby-progressbar (1.10.1)
19
+
20
+ PLATFORMS
21
+ ruby
22
+
23
+ DEPENDENCIES
24
+ bundler (~> 1.17)
25
+ chapmanchri_quotemachine2!
26
+ minitest (~> 5.0)
27
+ minitest-reporters (= 1.2.0)
28
+ rake (~> 10.0)
29
+
30
+ BUNDLED WITH
31
+ 1.17.2
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 TODO: Write your name
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # ChapmanchriQuotemachine2
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/chapmanchri_quotemachine2`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'chapmanchri_quotemachine2'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install chapmanchri_quotemachine2
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/chapmanchri_quotemachine2. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the ChapmanchriQuotemachine2 project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/chapmanchri_quotemachine2/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "chapmanchri_quotemachine2"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
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
@@ -0,0 +1,42 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "chapmanchri_quotemachine2/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "chapmanchri_quotemachine2"
8
+ spec.version = ChapmanchriQuotemachine2::VERSION
9
+ spec.authors = ["Chris Chapman"]
10
+ spec.email = ["chapmanchri@gmail.com"]
11
+
12
+ spec.summary = %q{Quote Machine}
13
+ spec.description = %q{Quote Machine}
14
+ spec.homepage = "https://chapapptive.com"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
21
+
22
+ # spec.metadata["homepage_uri"] = spec.homepage
23
+ # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
24
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
25
+ else
26
+ raise "RubyGems 2.0 or newer is required to protect against " \
27
+ "public gem pushes."
28
+ end
29
+
30
+ # Specify which files should be added to the gem when it is released.
31
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
32
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
33
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
34
+ end
35
+ spec.bindir = "exe"
36
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
+ spec.require_paths = ["lib"]
38
+
39
+ spec.add_development_dependency "bundler", "~> 1.17"
40
+ spec.add_development_dependency "rake", "~> 10.0"
41
+ spec.add_development_dependency "minitest", "~> 5.0"
42
+ end
@@ -0,0 +1,113 @@
1
+ 0
2
+
3
+ I believe in you my soul, the other I am must not abase itself to you,
4
+ And you must not be abased to the other.
5
+
6
+ Loafe with me on the grass, loose the stop from your throat,
7
+ Not words, not music or rhyme I want, not custom or lecture, not even the best,
8
+ Only the lull I like, the hum of your valvèd voice.
9
+
10
+ I mind how once we lay such a transparent summer morning,
11
+ How you settled your head athwart my hips and gently turn’d over upon me,
12
+ And parted the shirt from my bosom-bone, and plunged your tongue to my bare-stript heart,
13
+ And reach’d till you felt my beard, and reach’d till you held my feet.
14
+
15
+ Swiftly arose and spread around me the peace and knowledge that pass all the argument of the earth,
16
+ And I know that the hand of God is the promise of my own,
17
+ And I know that the spirit of God is the brother of my own,
18
+ And that all the men ever born are also my brothers, and the women my sisters and lovers,
19
+ And that a kelson of the creation is love,
20
+ And limitless are leaves stiff or drooping in the fields,
21
+ And brown ants in the little wells beneath them,
22
+ And mossy scabs of the worm fence, heap’d stones, elder, mullein and poke-weed.
23
+
24
+ 1
25
+
26
+ A child said WHAT IS THE GRASS? fetching it to me with full hands;
27
+ How could I answer the child? I do not know what it is any more than he.
28
+
29
+ I guess it must be the flag of my disposition, out of hopeful green stuff woven.
30
+
31
+ Or I guess it is the handkerchief of the Lord,
32
+ A scented gift and remembrancer designedly dropt,
33
+ Bearing the owner's name someway in the corners, that we may see and remark, and say Whose?
34
+
35
+ Or I guess the grass is itself a child, the produced babe of the vegetation.
36
+
37
+ Or I guess it is a uniform hieroglyphic,
38
+ And it means, Sprouting alike in broad zones and narrow zones,
39
+ Growing among black folks as among white,
40
+ Kanuck, Tuckahoe, Congressman, Cuff, I give them the same, I receive them the same.
41
+
42
+ And now it seems to me the beautiful uncut hair of graves.
43
+
44
+ Tenderly will I use you curling grass,
45
+ It may be you transpire from the breasts of young men,
46
+ It may be if I had known them I would have loved them,
47
+ It may be you are from old people, or from offspring taken soon out of their mothers' laps,
48
+ And here you are the mothers' laps.
49
+
50
+ This grass is very dark to be from the white heads of old mothers,
51
+ Darker than the colorless beards of old men,
52
+ Dark to come from under the faint red roofs of mouths.
53
+
54
+ O I perceive after all so many uttering tongues,
55
+ And I perceive they do not come from the roofs of mouths for nothing.
56
+
57
+ I wish I could translate the hints about the dead young men and women,
58
+
59
+ And the hints about old men and mothers, and the offspring taken soon out of their laps.
60
+
61
+ What do you think has become of the young and old men?
62
+ And what do you think has become of the women and children?
63
+
64
+ They are alive and well somewhere,
65
+ The smallest sprout shows there is really no death,
66
+ And if ever there was it led forward life, and does not wait at the end to arrest it,
67
+ And ceas'd the moment life appear'd.
68
+
69
+ All goes onward and outward, nothing collapses,
70
+ And to die is different from what any one supposed, and luckier.
71
+
72
+ 2
73
+
74
+ Has any one supposed it lucky to be born?
75
+ I hasten to inform him or her it is just as lucky to die, and I know it.
76
+
77
+ I pass death with the dying and birth with the new-wash’d babe, and am not contain’d between my hat and boots,
78
+ And peruse manifold objects, no two alike and every one good,
79
+ The earth good and the stars good, and their adjuncts all good.
80
+
81
+ I am not an earth nor an adjunct of an earth,
82
+ I am the mate and companion of people, all just as immortal and fathomless as myself,
83
+ (They do not know how immortal, but I know.)
84
+
85
+ Every kind for itself and its own, for me mine male and female,
86
+ For me those that have been boys and that love women,
87
+ For me the man that is proud and feels how it stings to be slighted,
88
+ For me the sweet-heart and the old maid, for me mothers and the mothers of mothers,
89
+ For me lips that have smiled, eyes that have shed tears,
90
+ For me children and the begetters of children.
91
+
92
+ Undrape! you are not guilty to me, nor stale nor discarded,
93
+ I see through the broadcloth and gingham whether or no,
94
+ And am around, tenacious, acquisitive, tireless, and cannot be shaken away.
95
+
96
+ 3
97
+
98
+ A stanza with only one section.
99
+
100
+ 4
101
+
102
+ A stanza with two sections.
103
+
104
+ The second section.
105
+
106
+ 5
107
+
108
+ A stanz with three sections.
109
+
110
+ Section two of three.
111
+
112
+ Section three of three.
113
+
@@ -0,0 +1,254 @@
1
+ require "chapmanchri_quotemachine2/version"
2
+
3
+ # module QuoteMachine
4
+ # class Error < StandardError; end
5
+ # # Your code goes here...
6
+ # end
7
+
8
+ # declare instance variables
9
+ def declare_instance_variables
10
+ @poem = []
11
+ @stanza_pick = 0
12
+ @stanza_current = 0
13
+ @section_current = 0
14
+ @section_previous = "na"
15
+ @section_next = "na"
16
+ end
17
+
18
+ def set_stanza_and_section
19
+ stanza = pick_stanza
20
+ @stanza_current = stanza
21
+ @section_current = pick_section(stanza)
22
+ end
23
+
24
+ def set_next_section
25
+ if @section_current < (@poem[@stanza_current].length-1)
26
+ @section_next = @section_current + 1
27
+ end
28
+ @section_next
29
+ end
30
+
31
+ def set_previous_section
32
+ if @section_current > 1
33
+ @section_previous = @section_current - 1
34
+ end
35
+ @section_previous
36
+ end
37
+
38
+
39
+ def read_poem(file_name)
40
+ # text = File.read(file_name)
41
+ File.read(file_name)
42
+ end
43
+
44
+ def convert_text_to_array(text)
45
+ # text_array = text.split("\n")
46
+ text.split("\n")
47
+ end
48
+
49
+
50
+ def create_final_poem_array(text_array)
51
+ # Convert text_array into a new two dimensional array (@poem)
52
+ # with each stanza it's own element in the
53
+ # @poem array and each segment in the @poem element an element in the @poem
54
+ # element.
55
+ stanza_num = 0
56
+ section = 0
57
+ text_array.each do |line|
58
+ if line.length == 1 #the stanza number
59
+
60
+ # puts "in stanza number"
61
+ if stanza_num == 0 && @poem[0] == nil
62
+ # puts "should be writing the first stanza number"
63
+ @poem[stanza_num] = line.split
64
+ else
65
+ # puts "in writing stanza 2 or more"
66
+ stanza_num +=1
67
+ section = 0
68
+ # puts "line is #{line}"
69
+ @poem[stanza_num] = line.split
70
+ # section += 1
71
+ # puts @poem[stanza_num][0]
72
+ end
73
+
74
+ elsif line == "" #these are blank lines which tell you a new section is beginning
75
+ # puts "in blank line"
76
+ section += 1
77
+ else
78
+ temp = @poem[stanza_num][section]
79
+ # puts "temp is #{temp.class}"
80
+ if temp.class == NilClass
81
+ @poem[stanza_num][section] = line
82
+ else
83
+ @poem[stanza_num][section] = @poem[stanza_num][section] + "<br>" + line
84
+ end
85
+ end
86
+ end
87
+ end
88
+
89
+
90
+ def pick_stanza
91
+ # stanza = rand(0...(@poem.length))
92
+ rand(0...(@poem.length))
93
+ end
94
+
95
+ def pick_section(stanza)
96
+ sections = @poem[stanza].length
97
+ # section = rand(1...(sections))
98
+ rand(1...(sections))
99
+ end
100
+
101
+ def show_current_section
102
+ "<div class='current_section_in_text'>#{@poem[@stanza_current][@section_current]}</div>"
103
+ end
104
+
105
+ def show_previous_section
106
+ if @section_current > 0
107
+ "#{@poem[@stanza_current][@section_current - 1]}"
108
+ end
109
+ end
110
+
111
+ def show_next_section
112
+ if @section_current < (@poem[@stanza_current].length - 1)
113
+ " #{@poem[@stanza_current][@section_current + 1]}"
114
+ end
115
+ end
116
+
117
+ def show_entire_verse
118
+ print_verse = ""
119
+ @poem[@stanza_current].each_with_index do |segment, i|
120
+ if i == @section_current
121
+ print_verse = print_verse + show_current_section + "<br>"
122
+ else
123
+ print_verse = print_verse + segment + "<br>"
124
+ end
125
+ end
126
+ print_verse
127
+ end
128
+
129
+ def show_entire_poem
130
+ print_poem = ""
131
+ @poem.each_with_index do |verse, v|
132
+ verse.each_with_index do |segment, s|
133
+ if s == @section_current && @stanza_current == v
134
+ print_poem = print_poem + show_current_section
135
+ # show_current_section
136
+ else
137
+ # puts segment
138
+ # puts "\n"
139
+ print_poem = print_poem + segment + "<br><br>"
140
+ end
141
+ end
142
+ end
143
+ print_poem
144
+ end
145
+
146
+ def clear_screen
147
+ puts `clear`
148
+ end
149
+
150
+ def show_section
151
+ # puts @poem[stanza][section_num]
152
+ # puts @poem[pick_stanza][pick_section]
153
+ # stanza = pick_stanza
154
+ # @stanza_current = stanza
155
+ # @section_current = pick_section(stanza)
156
+ @poem[@stanza_current][@section_current]
157
+ end
158
+
159
+
160
+ # Main Program
161
+
162
+ def main_program
163
+ declare_instance_variables
164
+ init_poem
165
+ set_stanza_and_section
166
+ show_section
167
+ # display_interface
168
+ end
169
+
170
+ def build_display
171
+ result_text = ""
172
+ @phrase.each do |section|
173
+
174
+ # Build For a stanza with only one section
175
+ if @poem[@stanza_current].length == 2
176
+ result_text = show_current_section
177
+ end
178
+
179
+ # Builds For a stanza with only two sections and only one phrase
180
+ if @poem[@stanza_current].length == 3
181
+ # if there is only one phrase
182
+ if @phrase.length == 1
183
+ #the phrase if the first phrase of the stanza
184
+ if @phrase[0] == 1
185
+ result_text = show_current_section + "<div class='plus-button'>+</div>"
186
+ #the phrase is the second phrase of the stanza
187
+ elsif @phrase[0] == 2
188
+ result_text = "<div class='plus-button'>+</div>" + show_current_section
189
+ end
190
+ end
191
+ end
192
+
193
+ # Builds for a Stanza with more than two sections and only one phrase
194
+ if @poem[@stanza_current].length > 3
195
+ if @phrase.length == 1
196
+ if @phrase[0] == 1
197
+ result_text = show_current_section + "<div class='plus-button'>+</div>"
198
+ elsif (@phrase[0] >= 2) && @phrase[0] < @poem[@stanza_current].length - 1
199
+ result_text = "<div class='plus-button'>+</div>" + show_current_section + "<div class='plus-button'>+</div>"
200
+ elsif @phrase[0] == @poem[@stanza_current].length - 1
201
+ result_text = "<div class='plus-button'>+</div>" + show_current_section
202
+ end
203
+ end
204
+ end
205
+
206
+ # Builds for Stanza with more than two sections and more than one phrase
207
+ if @poem[@stanza_current].length > 3
208
+ if @phrase.length > 1
209
+ # current_phrase is first in stanza and the second pharse is also displayed
210
+ if @phrase[0] == 1 && @section_current == 1 && @phrase[1] == 2
211
+ result_text = show_current_section + show_next_section + "<div class='minus-button'>-</div>"
212
+ end
213
+ # current_phrase is the last phrase in the stanza and the previous phrase is also displayed
214
+ if @phrase.last == @section_current && @phrase[@phrase.length - 2] == (@section_current - 1)
215
+ result_text = "<div class='minus-button'>-</div>#{show_previous_section}#{show_current_section}"
216
+ end
217
+ # there are two phrases in array, current_phrase is not first or last stanza,
218
+ # and current_phrase > second phrase
219
+ if @phrase.length == 2 && @section_current != 1 && @section_current != @poem[@stanza_current].length - 1
220
+ result_text = "<div class='minus-button'>-</div>#{show_previous_section}#{show_current_section}<div class='plus-button'>+</div>"
221
+ end
222
+ # there are two phrases in array, current_phrase is not first or last,
223
+ # and current_phrase < second phrase
224
+ if @phrase.length == 2 && @section_current != 1 \
225
+ && @section_current != @poem[@stanza_current].length - 1 \
226
+ && @phrase.last > @section_current
227
+ result_text = "<div class='plus-button'>+</div>#{show_current_section}#{show_next_section}<div class='minus-button'>-</div>"
228
+ end
229
+ # three phrases in the phrase storage array
230
+ if @phrase.length == 3
231
+ result_text = "<div class='minus-button'>+</div>#{show_previous_section}#{show_current_section}#{show_next_section}<div class='minus-button'>-</div>"
232
+ end
233
+ end
234
+ end
235
+
236
+ end
237
+ # show result
238
+ result_text
239
+ end
240
+
241
+ def init_poem
242
+ declare_instance_variables
243
+ text = read_poem('complete_verse.txt')
244
+ text_array = convert_text_to_array(text)
245
+ create_final_poem_array(text_array)
246
+ end
247
+
248
+ # run the program
249
+ puts Dir.pwd
250
+ # main_program
251
+
252
+ def test_method
253
+ "text"
254
+ end
@@ -0,0 +1,3 @@
1
+ module ChapmanchriQuotemachine2
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chapmanchri_quotemachine2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Chris Chapman
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-11-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.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
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: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ description: Quote Machine
56
+ email:
57
+ - chapmanchri@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".travis.yml"
64
+ - CODE_OF_CONDUCT.md
65
+ - Gemfile
66
+ - Gemfile.lock
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - bin/console
71
+ - bin/setup
72
+ - chapmanchri_quotemachine2.gemspec
73
+ - complete_verse.txt
74
+ - lib/chapmanchri_quotemachine2.rb
75
+ - lib/chapmanchri_quotemachine2/version.rb
76
+ homepage: https://chapapptive.com
77
+ licenses:
78
+ - MIT
79
+ metadata:
80
+ allowed_push_host: https://rubygems.org/
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubygems_version: 3.0.3
97
+ signing_key:
98
+ specification_version: 4
99
+ summary: Quote Machine
100
+ test_files: []