dharma_quotes 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 53e3f0d3ee879922bcb77ffc9f42e7623d68b72f
4
- data.tar.gz: 9fd68225c018d5c8ad8be7db46200bfdf40c28bd
2
+ SHA256:
3
+ metadata.gz: d8bda773b568e533065d311381e7610f2081f812e4f07d51a0de61dffdffbf23
4
+ data.tar.gz: 88e0b9af15831b2423da44ddabc7b2bd3ccebf5292c1fccc858a8af5e20f0884
5
5
  SHA512:
6
- metadata.gz: 0e6ecef26f64fd5deb5f423e9d851a6ffdf17a70683c5e5324c84faf0bb9aedcb95af8bab1833b19a2b3605437585fd8faa3a7c970db705e84a8065828f79cfa
7
- data.tar.gz: 3a6abd5003e4a18a7ec80e479bfbf264df56d27ee2a9c7b4cd5baee076104ecc5bd1fb58d0377db92121deb036cf15ed999e28bc7b520efa5aa24e1449b31e03
6
+ metadata.gz: 6657e04b18620a24077a7759f426b289cbc7742c2d08659587189de71f9131c091c4d3790d90dafbf545517b7185de5085da8a65d6243c9ea483bf4ae7957a13
7
+ data.tar.gz: 870cc4282c7306880d0ed2cd0b8a572a42c9dd2645ca094b5a87a19bacb7dcd9858f465bb88fb9c3c8fd0895d44040fc173c4750796f094fa19c5c9ddd3e7c30
data/README.md CHANGED
@@ -1,14 +1,27 @@
1
- # Dharma Quotes 1.1.0
1
+ # Dharma Quotes 1.2.0
2
+ ## Welcome to the new version of the gem, complete with RuboCop and the Dalai Lama!:monkey: :heart::skull: :fire: Thank you to all our Hacktoberfest 2020 contributors!
3
+
2
4
 
3
5
  ## Well namaste, it's the Ruby library of Dharma quotes! :heart:
4
6
 
5
- ## How to Install
7
+ New in this version:
8
+
9
+ - Functionality to get random quotes from the one and only Pema Chodron
10
+ - More unit tests added
11
+ - Contributing instructions added
12
+
13
+ ## How to Install :computer:
14
+
6
15
  In your command line, run the following command:
16
+
7
17
  ```bash
8
18
  gem install dharma_quotes
9
19
  ```
20
+
10
21
  ## Usage
22
+
11
23
  You can start using dharma_quotes with just a few lines of Ruby. In your Ruby file, type the following:
24
+
12
25
  ```ruby
13
26
  require 'dharma_quotes'
14
27
 
@@ -16,16 +29,33 @@ dharma_quotes = DharmaQuotes.new
16
29
  random_quote = dharma_quotes.get_quote
17
30
  puts random_quote
18
31
  ```
32
+ It's going to give you a quote for example:
33
+
34
+ ```
35
+ Animosity does not eradicate animosity.
36
+ Only by loving kindness is animosity dissolved.
37
+ This law is ancient and eternal. - The Dhammapada'
38
+ ```
39
+
40
+ You can be more specific too if you like! Ask for a quote from the Dhammapada; a quote from a miscellaneous source; or another option detailed below.
19
41
 
20
- You can be more specific too if you like! Ask for a quote from the Dhammapada; a quote from a miscellaneous source; one of the Four Noble Truths; or one of the tenets of the Noble Eightfold Path.
21
42
  ```ruby
22
43
  dhammapada_quote = dharma_quotes.get_dhammapada_quote
23
44
  misc_quote = dharma_quotes.get_quote_from_other_texts
24
45
  noble_truth = dharma_quotes.get_noble_truth
25
46
  part_of_noble_eightfold_path = dharma_quotes.get_part_of_eightfold_path
47
+ pema_chodron_quote = dharma_quotes.get_pema_chodron_quote
48
+ dalai_lama_quote = dharma_quotes.get_dalai_lama_quote
26
49
  ```
27
50
 
28
- ## Contributing
51
+ ### From command line
52
+
53
+ ```shell
54
+ $> quote
55
+ ```
56
+
57
+ ## Contributing :handshake:
58
+
29
59
  See 'CONTRIBUTING.md' for instructions.
30
60
 
31
61
  ## Enjoy life!
data/bin/quote ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative '../lib/dharma_quotes'
5
+
6
+ dharma_quotes = DharmaQuotes.new
7
+
8
+ random_quote = case ARGV[0]
9
+ when 'dhammapada'
10
+ dharma_quotes.get_dhammapada_quote
11
+ when 'misc'
12
+ dharma_quotes.get_quote_from_other_texts
13
+ when 'noble_truth'
14
+ dharma_quotes.get_noble_truth
15
+ when 'part_of_noble_eightfold_path'
16
+ dharma_quotes.get_part_of_eightfold_path
17
+ when 'pema_chodron'
18
+ dharma_quotes.get_pema_chodron_quote
19
+ when 'dalai_lama'
20
+ dharma_quotes.get_dalai_lama_quote
21
+ when '-h' || '--help'
22
+ %(
23
+ argument can be:
24
+ * dhammapada
25
+ * misc
26
+ * noble_truth
27
+ * part_of_noble_eightfold_path
28
+ * pema_chodron
29
+ * dalai_lama
30
+
31
+ Examples:
32
+ $> quote
33
+ $> quote nomble_truth
34
+ $> quote pema_chodron
35
+ )
36
+ else
37
+ dharma_quotes.get_quote
38
+ end
39
+
40
+ puts random_quote
data/lib/dharma_quotes.rb CHANGED
@@ -1,9 +1,11 @@
1
- require_relative './quote_libraries/dhammapada.rb'
2
- require_relative './quote_libraries/other_texts.rb'
3
- require_relative './quote_libraries/four_noble_truths.rb'
4
- require_relative './quote_libraries/noble_eightfold_path.rb'
5
- require_relative './quote_libraries/pema_chodron_books.rb'
1
+ # frozen_string_literal: true
6
2
 
3
+ require_relative './quote_libraries/dhammapada'
4
+ require_relative './quote_libraries/other_texts'
5
+ require_relative './quote_libraries/four_noble_truths'
6
+ require_relative './quote_libraries/noble_eightfold_path'
7
+ require_relative './quote_libraries/pema_chodron_books'
8
+ require_relative './quote_libraries/dalai_lama'
7
9
 
8
10
  class DharmaQuotes
9
11
  def initialize
@@ -12,13 +14,18 @@ class DharmaQuotes
12
14
  @four_noble_truths = FourNobleTruths.new.quotes
13
15
  @parts_of_eightfold_path = NobleEightfoldPath.new.quotes
14
16
  @pema_chodron_quotes = PemaChodronBooks.new.quotes
17
+ @dalai_lama_quotes = DalaiLama.new.quotes
15
18
  end
16
19
 
17
20
  def get_quote
18
- all_quotes = @dhammapada_quotes.concat(@other_texts_quotes)
19
- .concat(@four_noble_truths)
20
- .concat(@parts_of_eightfold_path)
21
- .concat(@pema_chodron_quotes)
21
+ all_quotes = [
22
+ @dhammapada_quotes,
23
+ @other_texts_quotes,
24
+ @four_noble_truths,
25
+ @parts_of_eightfold_path,
26
+ @pema_chodron_quotes,
27
+ @dalai_lama_quotes
28
+ ].flatten
22
29
 
23
30
  all_quotes.sample
24
31
  end
@@ -42,4 +49,8 @@ class DharmaQuotes
42
49
  def get_pema_chodron_quote
43
50
  @pema_chodron_quotes.sample
44
51
  end
45
- end
52
+
53
+ def get_dalai_lama_quote
54
+ @dalai_lama_quotes.sample
55
+ end
56
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ class DalaiLama
4
+ def initialize
5
+ @dalai_lama_quotes =
6
+ [
7
+ '
8
+ The more honest you are,
9
+ The more open,
10
+ The less fear you will have,
11
+ Because there\'s no anxiety about being exposed or revealed to others. - Dalai Lama',
12
+
13
+ '
14
+ Although you may not always be able to avoid difficult situations,
15
+ You can modify the extent to which you can suffer,
16
+ By how you choose to respond to the situation. - Dalai Lama',
17
+
18
+ '
19
+ We need to learn to want what we have,
20
+ Not to have what we want,
21
+ In order to get stable and steady happiness. - Dalai Lama'
22
+ ]
23
+ end
24
+
25
+ def quotes
26
+ @dalai_lama_quotes
27
+ end
28
+ end
@@ -1,18 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Dhammapada
2
- def initialize
3
- @dhammapada_quotes =
4
- [
4
+ def initialize
5
+ @dhammapada_quotes =
6
+ [
5
7
  '
6
- Animosity does not eradicate animosity.
7
- Only by loving kindness is animosity dissolved.
8
+ Animosity does not eradicate animosity.
9
+ Only by loving kindness is animosity dissolved.
8
10
  This law is ancient and eternal. - The Dhammapada',
9
-
11
+
10
12
  '
11
13
  Mind is the forerunner of all actions.
12
14
  All deeds are led by mind, created by mind.
13
15
  If one speaks or acts with corrupt mind, suffering follows,
14
16
  As the wheel follows the hoof of an ox pulling a cart. - The Dhammapada',
15
-
17
+
16
18
  '
17
19
  Mind is the forerunner of all actions.
18
20
  All deeds are led by mind, created by mind.
@@ -22,7 +24,7 @@ class Dhammapada
22
24
  '
23
25
  By oneself the evil is done, by oneself one suffers.
24
26
  By oneself evil is left undone, by oneself one is purified.
25
- The pure and the impure (stand and fall) by themselves: no one can purify another.
27
+ The pure and the impure (stand and fall) by themselves: no one can purify another.
26
28
  - The Dhammapada',
27
29
 
28
30
  '
@@ -60,11 +62,11 @@ class Dhammapada
60
62
  Colourful but scentless,
61
63
  The well-taught word is fruitless
62
64
  For one who does not practise. - The Dhammapada'
63
- ]
64
- end
65
+ ]
66
+ end
65
67
 
66
- # return the @dhammapada_quotes array stored in the instance var
67
- def quotes
68
- @dhammapada_quotes
69
- end
70
- end
68
+ # return the @dhammapada_quotes array stored in the instance var
69
+ def quotes
70
+ @dhammapada_quotes
71
+ end
72
+ end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class FourNobleTruths
2
4
  def initialize
3
- @four_noble_truths =
4
- [
5
+ @four_noble_truths =
6
+ [
5
7
  '
6
8
  To live is to suffer.',
7
9
 
@@ -10,13 +12,13 @@ class FourNobleTruths
10
12
 
11
13
  '
12
14
  We can end this suffering.',
13
-
15
+
14
16
  '
15
17
  The way to end our suffering is by following the Noble Eightfold Path.'
16
- ]
18
+ ]
17
19
  end
18
20
 
19
21
  def quotes
20
22
  @four_noble_truths
21
23
  end
22
- end
24
+ end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class NobleEightfoldPath
2
4
  def initialize
3
- @parts_of_eightfold_path =
4
- [
5
+ @parts_of_eightfold_path =
6
+ [
5
7
  '
6
8
  Samma Ditthi: right understanding',
7
9
 
@@ -22,13 +24,13 @@ class NobleEightfoldPath
22
24
 
23
25
  '
24
26
  Samma Sati: right mindfulness',
25
-
27
+
26
28
  '
27
29
  Samma Samadhi: right concentration'
28
- ]
30
+ ]
29
31
  end
30
32
 
31
33
  def quotes
32
34
  @parts_of_eightfold_path
33
35
  end
34
- end
36
+ end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class OtherTexts
2
4
  def initialize
3
- @quotes =
4
- [
5
+ @quotes =
6
+ [
5
7
  '
6
8
  On whom the heart insinctively rests,
7
9
  In whom the spirit finds delight,
@@ -63,10 +65,8 @@ class OtherTexts
63
65
  As a magician makes illusions
64
66
  Of horses, oxen, carts and other things
65
67
  Nothing is as it appears. - Samadhi Raja Sutra'
66
- ]
68
+ ]
67
69
  end
68
70
 
69
- def quotes
70
- @quotes
71
- end
72
- end
71
+ attr_reader :quotes
72
+ end
@@ -1,37 +1,39 @@
1
- # Ani Pema Chodron is a nun who has written many books on mindfulness and Buddhist philosophy.
1
+ # frozen_string_literal: true
2
+
3
+ # Ani Pema Chodron is a nun who has written many books on mindfulness and Buddhist philosophy.
2
4
  # She left the Shambhala Organisation in January 2020, explaining why here https://shambhalatimes.org/2020/01/16/letter-from-ani-pema-chodron/
3
5
  # What a legend!
4
6
 
5
7
  class PemaChodronBooks
6
8
  def initialize
7
- @pema_chodron_quotes =
8
- [
9
+ @pema_chodron_quotes =
10
+ [
9
11
  '
10
12
  The path is the goal. - Pema Chodron',
11
13
 
12
14
  '
13
- It isn\'t what happens to us that causes us to suffer; it\'s what we say to ourselves about
15
+ It isn\'t what happens to us that causes us to suffer; it\'s what we say to ourselves about
14
16
  happens. - Pema Chodron',
15
17
 
16
18
  '
17
19
  You are the sky. Everything else: it’s just the weather. - Pema Chodron',
18
20
 
19
21
  '
20
- Sticking with that uncertainty, getting the knack of relaxing in the midst of chaos,
22
+ Sticking with that uncertainty, getting the knack of relaxing in the midst of chaos,
21
23
  learning not to panic: this is the spiritual path. - Pema Chodron',
22
24
 
23
25
  '
24
26
  Be kinder to yourself. And then let your kindness flood the world. - Pema Chodron',
25
27
 
26
28
  '
27
- The only reason we don\'t open our hearts and minds to other people is that they trigger
28
- confusion in us that we don\'t feel brave enough or sane enough to deal with. To the degree
29
- that we look clearly and compassionately at ourselves, we feel confident and fearless about
29
+ The only reason we don\'t open our hearts and minds to other people is that they trigger
30
+ confusion in us that we don\'t feel brave enough or sane enough to deal with. To the degree
31
+ that we look clearly and compassionately at ourselves, we feel confident and fearless about
30
32
  looking into someone else\'s eyes. - Pema Chodron',
31
33
 
32
34
  '
33
35
  Someone needs to encourage us not to brush aside what we feel. Not to be ashamed of the love
34
- and grief that it arouses in us. Not to be afraid of pain. Someone needs to encourage us:
36
+ and grief that it arouses in us. Not to be afraid of pain. Someone needs to encourage us:
35
37
  that this soft spot in us could be awakened, and that to do this would
36
38
  change our lives. - Pema Chodron',
37
39
 
@@ -40,16 +42,16 @@ class PemaChodronBooks
40
42
  how not to run away. - Pema Chodron',
41
43
 
42
44
  '
43
- The central question of a warrior\'s training is not how we avoid uncertainty and fear but
45
+ The central question of a warrior\'s training is not how we avoid uncertainty and fear but
44
46
  how we relate to discomfort. - Pema Chodron',
45
47
 
46
48
  '
47
- Our true nature is like a precious jewel: although it may be temporarily buried in mud,
49
+ Our true nature is like a precious jewel: although it may be temporarily buried in mud,
48
50
  it remains completely brilliant and unaffected. We simply have to uncover it. - Pema Chodron'
49
- ]
51
+ ]
50
52
  end
51
53
 
52
54
  def quotes
53
55
  @pema_chodron_quotes
54
56
  end
55
- end
57
+ end
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dharma_quotes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evie Skinner
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2020-03-20 00:00:00.000000000 Z
@@ -24,17 +24,19 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.7'
27
- description: |-
28
- dharma_quotes is a cheerful library of quotes from Buddhist texts. It provides functionality
29
- to run methods that return random quotes from the Dharma.
27
+ description: dharma_quotes is a cheerful library of quotes from Buddhist texts. It
28
+ provides functionality to run methods that return random quotes from the Dharma.
30
29
  email: ohowkind@gmail.com
31
- executables: []
30
+ executables:
31
+ - quote
32
32
  extensions: []
33
33
  extra_rdoc_files: []
34
34
  files:
35
35
  - LICENCE.md
36
36
  - README.md
37
+ - bin/quote
37
38
  - lib/dharma_quotes.rb
39
+ - lib/quote_libraries/dalai_lama.rb
38
40
  - lib/quote_libraries/dhammapada.rb
39
41
  - lib/quote_libraries/four_noble_truths.rb
40
42
  - lib/quote_libraries/noble_eightfold_path.rb
@@ -44,7 +46,7 @@ homepage: https://github.com/Evie-Skinner18/dharma_quotes
44
46
  licenses:
45
47
  - MIT
46
48
  metadata: {}
47
- post_install_message:
49
+ post_install_message:
48
50
  rdoc_options: []
49
51
  require_paths:
50
52
  - lib
@@ -59,9 +61,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
61
  - !ruby/object:Gem::Version
60
62
  version: '0'
61
63
  requirements: []
62
- rubyforge_project:
63
- rubygems_version: 2.5.2.3
64
- signing_key:
64
+ rubygems_version: 3.2.3
65
+ signing_key:
65
66
  specification_version: 4
66
67
  summary: Generate random quotes from Buddhist texts
67
68
  test_files: []