cryptozoologist 2.1.0 → 3.0.0
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 +4 -4
- data/CHANGELOG.md +20 -0
- data/README.md +71 -27
- data/lib/cryptozoologist.rb +13 -14
- data/lib/cryptozoologist/configuration.rb +2 -1
- data/lib/cryptozoologist/dictionaries.rb +12 -0
- data/lib/cryptozoologist/dictionaries/addresses.rb +7 -0
- data/lib/cryptozoologist/dictionaries/filler.rb +9 -0
- data/lib/cryptozoologist/dictionaries/punctuation.rb +9 -0
- data/lib/cryptozoologist/dictionary.rb +12 -0
- data/lib/cryptozoologist/generator.rb +59 -0
- data/lib/cryptozoologist/version.rb +1 -1
- data/spec/cryptozoologist/configuration_spec.rb +20 -2
- data/spec/cryptozoologist/generator_spec.rb +76 -0
- data/spec/cryptozoologist_spec.rb +0 -10
- metadata +11 -5
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e52d93f21bb6d449f2e6ad9190323f9770519393
         | 
| 4 | 
            +
              data.tar.gz: 848a2751e0bb8611a24f712dedc6e5e8c4dd18b3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: e63efe1e7de416d9b40c48ed345e3bcf95660b2116ab7245fd035a417de8b53887e53d67a324cafb9b77dfd17e0bf553f6236933fa388ea63318d01a28a3d932
         | 
| 7 | 
            +
              data.tar.gz: 145b991a02fc26aa9b94f44ec06e951018c334473ec5e478b3807cf4c86dd1470191d6fda633b0c0afcb4e3da0fe174d522d791493df14074b153f4b00dc0dec
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,25 @@ | |
| 1 1 | 
             
            # Changelog
         | 
| 2 2 |  | 
| 3 | 
            +
            ## 3.0.0
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            **Important!!** Now requires Ruby 2.3.0 or higher (as of writing, Ruby 2.2 is in security maintenance mode, while 2.3 is in normal maintanance mode).
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            **New features!**
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            - now with lorem ipsum generation! `Cryptozoologist.lorem(sentence_count)`
         | 
| 10 | 
            +
            - added a street address method - you too can live at 1290 Sloth Circle! `Cryptozoologist.street_address`
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            **API Changes**
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            - configuration is now  _reset_ if you call the `configure` block again after having already called it
         | 
| 15 | 
            +
            - renamed `Cryptozoologist.generate` to `Cryptozoologist.random` (backwards compatible)
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            **Bug fixes**
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            - fix a bug where if you included `[:quantity]` words, you would get an extra quantity word for each time you called `generate` (lol this was very amusing)
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            ---
         | 
| 22 | 
            +
             | 
| 3 23 | 
             
            ## 2.1.0
         | 
| 4 24 |  | 
| 5 25 | 
             
            - added test coverage
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,8 +1,8 @@ | |
| 1 1 | 
             
            # Cryptozoologist [](https://travis-ci.org/feministy/cryptozoologist)
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 3 | 
            +
            Cryptozoologist generates random strings from animal, clothing item, and color pairings, as well as lorem ipsum style sentences. 
         | 
| 4 4 |  | 
| 5 | 
            -
             | 
| 5 | 
            +
            You could get something like "orange-clownfish-turtleneck" or "magenta-three-toed-sloth-shoe-horn". It's fun and silly, because why not? The gem can be configured to use a custom delimiter, exclude dictionaries, or add in speciality dictionaries.
         | 
| 6 6 |  | 
| 7 7 | 
             
            ## Installation
         | 
| 8 8 |  | 
| @@ -22,33 +22,75 @@ Or install it yourself as: | |
| 22 22 |  | 
| 23 23 | 
             
            ## Usage
         | 
| 24 24 |  | 
| 25 | 
            -
             | 
| 25 | 
            +
            Cryptozoologist provides two main functions:
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            * `Cryptozoologist.random`: returns a string separated by a delimiter (_Note_: aliased as `Cryptozoologist.generate` for backwards compatibility with anything below version 3)
         | 
| 28 | 
            +
            * `Cryptozoologist.lorem(sentence_count)`: returns `sentence_count` number of sentences, separated by punctuation randomly selected from `["!", ".", "?"]`
         | 
| 29 | 
            +
            * `Cryptozoologist.street_address`: returns a string formatted to US street address standards (house number and street name) using the animal dictionaries (_Note_: ignores animal subdictionary exclusions)
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            Each method will respect your configuration settings where applicable.
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            See below for more detailed usage on each method.
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            ### Secret usage
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            If you just want a word list, you can tap directly into the dictionaries. Each dictionary returns an array of strings, allowing you to use the Ruby enumerators that you want on your word list.
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            The complete list of dictionaries includes:
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            * `Cryptozoologist::Dictionary.animals`
         | 
| 42 | 
            +
            * `Cryptozoologist::Dictionary.clothing`
         | 
| 43 | 
            +
            * `Cryptozoologist::Dictionary.colors`
         | 
| 44 | 
            +
            * `Cryptozoologist::Dictionary.quantity`
         | 
| 45 | 
            +
            * `Cryptozoologist::Dictionary.filler` ("a", "the", etc)
         | 
| 46 | 
            +
            * `Cryptozoologist::Dictionary.punctuation`
         | 
| 47 | 
            +
            * `Cryptozoologist::Dictionary.addresses` ("Lane", "Street", etc - I don't know what this part of an address is called!)
         | 
| 48 | 
            +
             | 
| 49 | 
            +
            ### `Cryptozoologist.random`
         | 
| 50 | 
            +
             | 
| 51 | 
            +
            The `Cryptozoologist.random` method will return a string separated by `-` (or your custom delimiter) containing: a color, an animal, and an item of clothing.
         | 
| 52 | 
            +
             | 
| 53 | 
            +
            Example:
         | 
| 54 | 
            +
             | 
| 55 | 
            +
            ```ruby
         | 
| 56 | 
            +
            Cryptozoologist.random # => 'steel-blue-tang-flak-jacket'
         | 
| 57 | 
            +
            Cryptozoologist.random # => 'blanched-almond-mandrill-headscarf'
         | 
| 58 | 
            +
            Cryptozoologist.random # => 'frozen-in-time-cockroach-bracelet'
         | 
| 59 | 
            +
            Cryptozoologist.random # => 'medium-sea-green-lobster-coat'
         | 
| 60 | 
            +
            Cryptozoologist.random # => 'blue-flying-squirrel-trench-coat'
         | 
| 61 | 
            +
            Cryptozoologist.random # => 'thistle-toucan-formal-wear'
         | 
| 62 | 
            +
            Cryptozoologist.random # => 'aquamarine-lemming-white-tie'
         | 
| 63 | 
            +
            Cryptozoologist.random # => 'tomato-cerberus-sweatshirt'
         | 
| 64 | 
            +
            Cryptozoologist.random # => 'forest-green-wasp-getup'
         | 
| 65 | 
            +
            ```
         | 
| 66 | 
            +
             | 
| 67 | 
            +
            If your config includes the `Quantity` dictionary, it will be prepended to your string.
         | 
| 68 | 
            +
             | 
| 69 | 
            +
            ### `Cryptozoologist.lorem(sentence_count)`
         | 
| 70 | 
            +
             | 
| 71 | 
            +
            `Cryptozoologist.lorem(sentence_count)` will return a string consisting of the number of sentences you request. It will use every dictionary available based on your config.
         | 
| 26 72 |  | 
| 27 73 | 
             
            Example:
         | 
| 28 74 |  | 
| 29 75 | 
             
            ```ruby
         | 
| 30 | 
            -
            Cryptozoologist. | 
| 31 | 
            -
             | 
| 32 | 
            -
            Cryptozoologist. | 
| 33 | 
            -
            Cryptozoologist.generate # => 'medium-sea-green-lobster-coat'
         | 
| 34 | 
            -
            Cryptozoologist.generate # => 'blue-flying-squirrel-trench-coat'
         | 
| 35 | 
            -
            Cryptozoologist.generate # => 'thistle-toucan-formal-wear'
         | 
| 36 | 
            -
            Cryptozoologist.generate # => 'aquamarine-lemming-white-tie'
         | 
| 37 | 
            -
            Cryptozoologist.generate # => 'tomato-cerberus-sweatshirt'
         | 
| 38 | 
            -
            Cryptozoologist.generate # => 'forest-green-wasp-getup'
         | 
| 76 | 
            +
            Cryptozoologist.lorem(3) # => 'Black rhinoceros and it hundreds at flamingo dream oodles acres gear it plum serval shrug phoenix blazer washed khaki! Phantom mist the gazillions hem alicorn light golden rod yellow leopard cat troop and galoshes a be. Are there stellers sea cow billions be plum indri dodger blue shift to t shirt cheetah tiara tons sky blue miles?'
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            Cryptozoologist.lorem(1) # => 'And headscarf to potentially purple pygmy puff chocolate wide tights yak bundles the be?'
         | 
| 39 79 | 
             
            ```
         | 
| 40 80 |  | 
| 41 | 
            -
            ###  | 
| 81 | 
            +
            ### `Cryptozoologist.street_address`
         | 
| 42 82 |  | 
| 43 | 
            -
             | 
| 83 | 
            +
            Haven't you always wanted a cool address like 12 Pygmy Puff Court? Me, too. 
         | 
| 44 84 |  | 
| 45 85 | 
             
            ```ruby
         | 
| 46 | 
            -
            Cryptozoologist | 
| 47 | 
            -
            Cryptozoologist | 
| 48 | 
            -
            Cryptozoologist | 
| 49 | 
            -
            Cryptozoologist | 
| 86 | 
            +
            Cryptozoologist.street_address # => 2295 Red Panda Avenue
         | 
| 87 | 
            +
            Cryptozoologist.street_address # => 947 Valkyrie Way
         | 
| 88 | 
            +
            Cryptozoologist.street_address # => 2415 Goblin Street
         | 
| 89 | 
            +
            Cryptozoologist.street_address # => 2558 Sea Dragon Court
         | 
| 50 90 | 
             
            ```
         | 
| 51 91 |  | 
| 92 | 
            +
            This only uses the `Animal` dictionaries and will *ignore your configuration to exclude subdictionaries*.
         | 
| 93 | 
            +
             | 
| 52 94 | 
             
            ## Configuration 
         | 
| 53 95 |  | 
| 54 96 | 
             
            Configuration blocks take the following options:
         | 
| @@ -64,7 +106,7 @@ Configuration blocks take the following options: | |
| 64 106 |  | 
| 65 107 | 
             
            - `exclude` (array of symbols) allows you to exclude dictionary subtypes; defaults to no exclusions
         | 
| 66 108 | 
             
            - `include` (array of symbols) allows you to include optional dictionaries; defaults to no inclusions
         | 
| 67 | 
            -
            - `order` (array of symbols) allows you to change the word order; defaults to animal-color-clothing
         | 
| 109 | 
            +
            - `order` (array of symbols) allows you to change the word order; defaults to `animal-color-clothing`
         | 
| 68 110 | 
             
            - `delimiter` (string) allows you to specify a delimiter; defaults to `-`
         | 
| 69 111 |  | 
| 70 112 | 
             
            ### Configuration options
         | 
| @@ -72,16 +114,18 @@ Configuration blocks take the following options: | |
| 72 114 | 
             
            **Include (`config.include`, `[]`):**
         | 
| 73 115 |  | 
| 74 116 | 
             
            - if you include quantity, it will be added to the front of your generated string
         | 
| 75 | 
            -
            - `:quantity`
         | 
| 117 | 
            +
            - options: `:quantity`
         | 
| 76 118 |  | 
| 77 119 | 
             
            **Exclude (`config.exclude`, `[]`):**
         | 
| 78 120 |  | 
| 121 | 
            +
            4 options are available for this, but you can only use 2 at a time (one from each category):
         | 
| 122 | 
            +
             | 
| 79 123 | 
             
            - animals (1 of 2 allowed):
         | 
| 80 124 | 
             
              - `:common`, `:mythical`
         | 
| 81 125 | 
             
            - colors (1 of 2 allowed):
         | 
| 82 126 | 
             
              - `:paint`, `:web`
         | 
| 83 127 |  | 
| 84 | 
            -
            **Order (`config.order`, `[]`) | 
| 128 | 
            +
            **Order (`config.order`, `[]`):**
         | 
| 85 129 |  | 
| 86 130 | 
             
            - **must provide all 3 keys** as an array in the order in which you want words to appear
         | 
| 87 131 | 
             
            - `[:animals, :colors, :clothing]`
         | 
| @@ -91,18 +135,18 @@ Configuration blocks take the following options: | |
| 91 135 | 
             
            - defaults to `'-'`
         | 
| 92 136 | 
             
            - any string is valid
         | 
| 93 137 |  | 
| 94 | 
            -
            #### Example
         | 
| 138 | 
            +
            #### Example with all possible settings
         | 
| 95 139 |  | 
| 96 140 | 
             
            ```ruby
         | 
| 97 141 | 
             
              Cryptozoologist.configure do |config|
         | 
| 98 | 
            -
                config.exclude = [:common]
         | 
| 142 | 
            +
                config.exclude = [:common, :paint]
         | 
| 99 143 | 
             
                config.include = [:quantity]
         | 
| 100 144 | 
             
                config.order = [:colors, :animals, :clothing]
         | 
| 101 145 | 
             
                config.delimiter = '_'
         | 
| 102 146 | 
             
              end
         | 
| 103 147 |  | 
| 104 | 
            -
              Cryptozoologist. | 
| 105 | 
            -
              Cryptozoologist. | 
| 106 | 
            -
              Cryptozoologist. | 
| 107 | 
            -
              Cryptozoologist. | 
| 148 | 
            +
              Cryptozoologist.random # => 'masses_yellow_zombie_shrug'
         | 
| 149 | 
            +
              Cryptozoologist.random # => 'gazillions_purple_goblin_umbrella'
         | 
| 150 | 
            +
              Cryptozoologist.random # => 'wide_orange_cynocephalus_helmet'
         | 
| 151 | 
            +
              Cryptozoologist.random # => 'some_light_pink_moke_fedora'
         | 
| 108 152 | 
             
            ```
         | 
    
        data/lib/cryptozoologist.rb
    CHANGED
    
    | @@ -7,6 +7,7 @@ Dir[dictionaries].each { |file| require file } | |
| 7 7 |  | 
| 8 8 | 
             
            require "cryptozoologist/dictionary"
         | 
| 9 9 | 
             
            require "cryptozoologist/dictionaries"
         | 
| 10 | 
            +
            require "cryptozoologist/generator"
         | 
| 10 11 |  | 
| 11 12 | 
             
            module Cryptozoologist
         | 
| 12 13 | 
             
              class << self
         | 
| @@ -22,26 +23,24 @@ module Cryptozoologist | |
| 22 23 | 
             
              end
         | 
| 23 24 |  | 
| 24 25 | 
             
              def self.configure
         | 
| 26 | 
            +
                self.reset
         | 
| 25 27 | 
             
                yield(configuration)
         | 
| 26 28 | 
             
              end
         | 
| 27 29 |  | 
| 28 | 
            -
              def self. | 
| 29 | 
            -
                 | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
                order.unshift(:quantity) if @configuration.include_quantity?
         | 
| 30 | 
            +
              def self.lorem(sentence_count=1)
         | 
| 31 | 
            +
                Generator.lorem(sentence_count)
         | 
| 32 | 
            +
              end
         | 
| 33 33 |  | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
                  string += "#{compound_word}"
         | 
| 34 | 
            +
              def self.random
         | 
| 35 | 
            +
                Generator.random
         | 
| 36 | 
            +
              end
         | 
| 38 37 |  | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
                end
         | 
| 38 | 
            +
              def self.generate
         | 
| 39 | 
            +
                Generator.random
         | 
| 40 | 
            +
              end
         | 
| 43 41 |  | 
| 44 | 
            -
             | 
| 42 | 
            +
              def self.street_address
         | 
| 43 | 
            +
                Generator.street_address
         | 
| 45 44 | 
             
              end
         | 
| 46 45 |  | 
| 47 46 | 
             
              protected 
         | 
| @@ -14,7 +14,6 @@ module Cryptozoologist | |
| 14 14 | 
             
                  raise Errors::Configuration, "Order must contain 3 items" unless list.length == 3
         | 
| 15 15 | 
             
                  invalid_keys = list.select { |e| !valid_order.include?(e) }
         | 
| 16 16 | 
             
                  raise Errors::Configuration, "Invalid order setting provided: #{invalid_keys}" unless invalid_keys.empty?
         | 
| 17 | 
            -
             | 
| 18 17 | 
             
                  @order = list
         | 
| 19 18 | 
             
                end
         | 
| 20 19 |  | 
| @@ -28,6 +27,8 @@ module Cryptozoologist | |
| 28 27 | 
             
                  raise Errors::Configuration, "Inclusions must be an array" unless inclusions.is_a?(Array)
         | 
| 29 28 |  | 
| 30 29 | 
             
                  @include = inclusions.select { |e| valid_inclusions.include?(e) }
         | 
| 30 | 
            +
                  inclusions += @order
         | 
| 31 | 
            +
                  @order = inclusions
         | 
| 31 32 | 
             
                end
         | 
| 32 33 |  | 
| 33 34 | 
             
                def exclude=(exclusions)
         | 
| @@ -0,0 +1,59 @@ | |
| 1 | 
            +
            module Cryptozoologist
         | 
| 2 | 
            +
              module Generator
         | 
| 3 | 
            +
                extend self
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                # Generates sentence_count sentences, ranging in length from 10-16 words,
         | 
| 6 | 
            +
                # using the dictionaries from your config.
         | 
| 7 | 
            +
                # 
         | 
| 8 | 
            +
                def lorem(sentence_count)
         | 
| 9 | 
            +
                  sentences = []
         | 
| 10 | 
            +
                  order = Cryptozoologist.configuration.order
         | 
| 11 | 
            +
                  sentence_count.times do
         | 
| 12 | 
            +
                    words = []
         | 
| 13 | 
            +
                    length = rand(9..16)
         | 
| 14 | 
            +
                    per_dictionary = length / order.length
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                    order.each do |library|
         | 
| 17 | 
            +
                      words += Dictionary.send(library).sample(per_dictionary)
         | 
| 18 | 
            +
                      words << Dictionary.filler.sample
         | 
| 19 | 
            +
                    end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                    words.shuffle!
         | 
| 22 | 
            +
                    sentence = words.join(" ")
         | 
| 23 | 
            +
                    sentence.capitalize!
         | 
| 24 | 
            +
                    sentence << Dictionary.punctuation.sample
         | 
| 25 | 
            +
                    sentences << sentence
         | 
| 26 | 
            +
                  end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  sentences.join(" ")
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                # Generates a string using the dictionaries and delimiter from your config.
         | 
| 32 | 
            +
                # 
         | 
| 33 | 
            +
                def random
         | 
| 34 | 
            +
                  string = ""
         | 
| 35 | 
            +
                  order = Cryptozoologist.configuration.order
         | 
| 36 | 
            +
                  order.each do |library|
         | 
| 37 | 
            +
                    word = Dictionary.send(library).sample
         | 
| 38 | 
            +
                    compound_word = word.split(' ').join(Cryptozoologist.configuration.delimiter)
         | 
| 39 | 
            +
                    string += "#{compound_word}"
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                    unless library == Cryptozoologist.configuration.order.last
         | 
| 42 | 
            +
                      string += "#{Cryptozoologist.configuration.delimiter}" 
         | 
| 43 | 
            +
                    end
         | 
| 44 | 
            +
                  end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                  string
         | 
| 47 | 
            +
                end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                # Generates a string for a street address with a number and street. Only
         | 
| 50 | 
            +
                # uses animal dictionaries and does not respect config exclusions.
         | 
| 51 | 
            +
                # 
         | 
| 52 | 
            +
                def street_address
         | 
| 53 | 
            +
                  number = rand(1..9000)
         | 
| 54 | 
            +
                  street = Dictionary.animals.sample
         | 
| 55 | 
            +
                  street = street.split(" ").map! {|word| word.capitalize! }.join(" ")
         | 
| 56 | 
            +
                  "#{number} #{street} #{Dictionary.addresses.sample}"
         | 
| 57 | 
            +
                end
         | 
| 58 | 
            +
              end
         | 
| 59 | 
            +
            end
         | 
| @@ -12,6 +12,24 @@ describe Cryptozoologist::Configuration do | |
| 12 12 | 
             
                end
         | 
| 13 13 | 
             
              end
         | 
| 14 14 |  | 
| 15 | 
            +
              context 'configuration collision' do
         | 
| 16 | 
            +
                it 'does not happen' do
         | 
| 17 | 
            +
                  Cryptozoologist.configure do |config|
         | 
| 18 | 
            +
                    config.delimiter = "_"
         | 
| 19 | 
            +
                  end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  expect(Cryptozoologist.configuration.delimiter).to eq("_")
         | 
| 22 | 
            +
                  expect(Cryptozoologist.configuration.include_quantity?).to be false
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                  Cryptozoologist.configure do |config|
         | 
| 25 | 
            +
                    config.include = [:quantity]
         | 
| 26 | 
            +
                  end      
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                  expect(Cryptozoologist.configuration.delimiter).to_not eq("_")
         | 
| 29 | 
            +
                  expect(Cryptozoologist.configuration.include_quantity?).to be true
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
              end
         | 
| 32 | 
            +
             | 
| 15 33 | 
             
              context 'exclusions' do
         | 
| 16 34 | 
             
                it 'filters out invalid exclusions' do
         | 
| 17 35 | 
             
                  Cryptozoologist.configure do |config|
         | 
| @@ -66,7 +84,7 @@ describe Cryptozoologist::Configuration do | |
| 66 84 |  | 
| 67 85 | 
             
              context '#delimiter' do
         | 
| 68 86 | 
             
                it 'defaults to "-"' do
         | 
| 69 | 
            -
                  expect(Cryptozoologist. | 
| 87 | 
            +
                  expect(Cryptozoologist.random.match('-')).to be_instance_of(MatchData)
         | 
| 70 88 | 
             
                end
         | 
| 71 89 |  | 
| 72 90 | 
             
                it 'requires a string' do
         | 
| @@ -82,7 +100,7 @@ describe Cryptozoologist::Configuration do | |
| 82 100 | 
             
                    config.delimiter ='$'
         | 
| 83 101 | 
             
                  end
         | 
| 84 102 |  | 
| 85 | 
            -
                  expect(Cryptozoologist. | 
| 103 | 
            +
                  expect(Cryptozoologist.random.match('$')).to be_instance_of(MatchData)
         | 
| 86 104 | 
             
                end
         | 
| 87 105 | 
             
              end
         | 
| 88 106 |  | 
| @@ -0,0 +1,76 @@ | |
| 1 | 
            +
            require 'spec_helper'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            describe Cryptozoologist do
         | 
| 4 | 
            +
              context '#lorem' do
         | 
| 5 | 
            +
                it 'returns a string' do
         | 
| 6 | 
            +
                  expect(Cryptozoologist.lorem(1)).to be_instance_of(String)
         | 
| 7 | 
            +
                end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                it 'defaults to one sentence if an argument is not provided' do
         | 
| 10 | 
            +
                  expect(Cryptozoologist.lorem).to be_instance_of(String)
         | 
| 11 | 
            +
                  expect(Cryptozoologist::Dictionary.punctuation.include?(Cryptozoologist.lorem[-1])).to be true
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                it 'generates the number of sentences requested' do
         | 
| 15 | 
            +
                  sentence = Cryptozoologist.lorem(3)
         | 
| 16 | 
            +
                  punctuation = sentence.gsub!(/\w/, "").gsub!(" ", "")
         | 
| 17 | 
            +
                  expect(punctuation.length).to eq(3)
         | 
| 18 | 
            +
                end
         | 
| 19 | 
            +
              end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
              context '#random' do
         | 
| 22 | 
            +
                it 'returns a string' do
         | 
| 23 | 
            +
                  expect(Cryptozoologist.random).to be_instance_of(String)
         | 
| 24 | 
            +
                end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                it 'returns a string with the delimiter' do
         | 
| 27 | 
            +
                  expect(Cryptozoologist.random.match('-')).to be_instance_of(MatchData)
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                describe('with quantity') do
         | 
| 31 | 
            +
                  before do
         | 
| 32 | 
            +
                    Cryptozoologist.configure do |config|
         | 
| 33 | 
            +
                      config.include = [:quantity]
         | 
| 34 | 
            +
                      config.delimiter = "_"
         | 
| 35 | 
            +
                    end
         | 
| 36 | 
            +
                  end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                  it 'returns a string with quantity' do
         | 
| 39 | 
            +
                    random = Cryptozoologist.random.split("_")
         | 
| 40 | 
            +
                    expect(Cryptozoologist::Dictionaries::Quantity.list.include?(random.first)).to be true
         | 
| 41 | 
            +
                  end
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                  it 'only has one word from the quantity list' do
         | 
| 44 | 
            +
                    Cryptozoologist.random
         | 
| 45 | 
            +
                    random = Cryptozoologist.random.split("_")
         | 
| 46 | 
            +
                    matches = Cryptozoologist::Dictionaries::Quantity.list.select do |word|
         | 
| 47 | 
            +
                      random.include?(word)
         | 
| 48 | 
            +
                    end
         | 
| 49 | 
            +
                    expect(matches.length).to eq(1)
         | 
| 50 | 
            +
                  end
         | 
| 51 | 
            +
                end
         | 
| 52 | 
            +
              end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
              context '#street_address' do
         | 
| 55 | 
            +
                before do
         | 
| 56 | 
            +
                  @street = Cryptozoologist.street_address.split(" ")
         | 
| 57 | 
            +
                end
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                it 'includes a number' do
         | 
| 60 | 
            +
                  expect(@street.first.to_i).to be > 0
         | 
| 61 | 
            +
                  expect(@street.first.to_i).to be < 9001
         | 
| 62 | 
            +
                end
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                it 'includes an animal' do
         | 
| 65 | 
            +
                  street = @street
         | 
| 66 | 
            +
                  street.pop
         | 
| 67 | 
            +
                  street.shift
         | 
| 68 | 
            +
                  street = street.join(" ").downcase
         | 
| 69 | 
            +
                  expect(Cryptozoologist::Dictionary.animals.include?(street)).to be true
         | 
| 70 | 
            +
                end
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                it 'includes an address label' do
         | 
| 73 | 
            +
                  expect(Cryptozoologist::Dictionary.addresses.include?(@street.last)).to be true
         | 
| 74 | 
            +
                end
         | 
| 75 | 
            +
              end
         | 
| 76 | 
            +
            end
         | 
| @@ -14,14 +14,4 @@ describe Cryptozoologist do | |
| 14 14 | 
             
                Cryptozoologist.reset
         | 
| 15 15 | 
             
                expect(Cryptozoologist.configuration.exclude).to eq([])
         | 
| 16 16 | 
             
              end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
              context '#generate' do
         | 
| 19 | 
            -
                it 'returns a string' do
         | 
| 20 | 
            -
                  expect(Cryptozoologist.generate).to be_instance_of(String)
         | 
| 21 | 
            -
                end
         | 
| 22 | 
            -
             | 
| 23 | 
            -
                it 'returns a string with the delimiter' do
         | 
| 24 | 
            -
                  expect(Cryptozoologist.generate.match('-')).to be_instance_of(MatchData)
         | 
| 25 | 
            -
                end
         | 
| 26 | 
            -
              end
         | 
| 27 17 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: cryptozoologist
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 3.0.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Liz Abinante
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2017-05-03 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -81,8 +81,8 @@ dependencies: | |
| 81 81 | 
             
                  - !ruby/object:Gem::Version
         | 
| 82 82 | 
             
                    version: 0.2.4
         | 
| 83 83 | 
             
            description: Cryptozoologist generates random strings from animal, clothing item,
         | 
| 84 | 
            -
              and color pairings.  | 
| 85 | 
            -
               | 
| 84 | 
            +
              and color pairings. It's fun and silly, because who doesn't want an orange sloth
         | 
| 85 | 
            +
              turtleneck?
         | 
| 86 86 | 
             
            email:
         | 
| 87 87 | 
             
            - me@liz.codes
         | 
| 88 88 | 
             
            executables: []
         | 
| @@ -96,18 +96,23 @@ files: | |
| 96 96 | 
             
            - lib/cryptozoologist.rb
         | 
| 97 97 | 
             
            - lib/cryptozoologist/configuration.rb
         | 
| 98 98 | 
             
            - lib/cryptozoologist/dictionaries.rb
         | 
| 99 | 
            +
            - lib/cryptozoologist/dictionaries/addresses.rb
         | 
| 99 100 | 
             
            - lib/cryptozoologist/dictionaries/animals/common.rb
         | 
| 100 101 | 
             
            - lib/cryptozoologist/dictionaries/animals/mythical.rb
         | 
| 101 102 | 
             
            - lib/cryptozoologist/dictionaries/clothing.rb
         | 
| 102 103 | 
             
            - lib/cryptozoologist/dictionaries/colors/paint.rb
         | 
| 103 104 | 
             
            - lib/cryptozoologist/dictionaries/colors/web_safe.rb
         | 
| 105 | 
            +
            - lib/cryptozoologist/dictionaries/filler.rb
         | 
| 106 | 
            +
            - lib/cryptozoologist/dictionaries/punctuation.rb
         | 
| 104 107 | 
             
            - lib/cryptozoologist/dictionaries/quantity.rb
         | 
| 105 108 | 
             
            - lib/cryptozoologist/dictionary.rb
         | 
| 106 109 | 
             
            - lib/cryptozoologist/errors.rb
         | 
| 110 | 
            +
            - lib/cryptozoologist/generator.rb
         | 
| 107 111 | 
             
            - lib/cryptozoologist/version.rb
         | 
| 108 112 | 
             
            - spec/cryptozoologist/configuration_spec.rb
         | 
| 109 113 | 
             
            - spec/cryptozoologist/dictionaries_spec.rb
         | 
| 110 114 | 
             
            - spec/cryptozoologist/dictionary_spec.rb
         | 
| 115 | 
            +
            - spec/cryptozoologist/generator_spec.rb
         | 
| 111 116 | 
             
            - spec/cryptozoologist_spec.rb
         | 
| 112 117 | 
             
            - spec/spec_helper.rb
         | 
| 113 118 | 
             
            homepage: https://github.com/feministy/cryptozoologist
         | 
| @@ -122,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 122 127 | 
             
              requirements:
         | 
| 123 128 | 
             
              - - ">="
         | 
| 124 129 | 
             
                - !ruby/object:Gem::Version
         | 
| 125 | 
            -
                  version: 2. | 
| 130 | 
            +
                  version: 2.3.0
         | 
| 126 131 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 127 132 | 
             
              requirements:
         | 
| 128 133 | 
             
              - - ">="
         | 
| @@ -138,5 +143,6 @@ test_files: | |
| 138 143 | 
             
            - spec/cryptozoologist/configuration_spec.rb
         | 
| 139 144 | 
             
            - spec/cryptozoologist/dictionaries_spec.rb
         | 
| 140 145 | 
             
            - spec/cryptozoologist/dictionary_spec.rb
         | 
| 146 | 
            +
            - spec/cryptozoologist/generator_spec.rb
         | 
| 141 147 | 
             
            - spec/cryptozoologist_spec.rb
         | 
| 142 148 | 
             
            - spec/spec_helper.rb
         |