connie 0.1.0 → 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.
- data/Gemfile +3 -4
- data/VERSION +1 -1
- data/connie.gemspec +11 -17
- data/lib/connie.rb +6 -0
- data/lib/connie/connie.rb +1 -1
- data/lib/connie/parser.rb +3 -4
- data/spec/connie_spec.rb +8 -5
- data/spec/spec_helper.rb +1 -0
- data/spec/test_dictionaries/numbers/ordinal +1 -4
- metadata +19 -47
    
        data/Gemfile
    CHANGED
    
    
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.1. | 
| 1 | 
            +
            0.1.1
         | 
    
        data/connie.gemspec
    CHANGED
    
    | @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = %q{connie}
         | 
| 8 | 
            -
              s.version = "0.1. | 
| 8 | 
            +
              s.version = "0.1.1"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Leandro Pedroni"]
         | 
| 12 | 
            -
              s.date = %q{2011- | 
| 12 | 
            +
              s.date = %q{2011-10-02}
         | 
| 13 13 | 
             
              s.description = %q{Heavily based on Forgery it uses the same word sources. It's built to be a bit more customisable and allows you to define new strategies and styles both using ruby modules or big text lists.}
         | 
| 14 14 | 
             
              s.email = %q{ilpoldo@gmail.com}
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
| @@ -63,31 +63,25 @@ Gem::Specification.new do |s| | |
| 63 63 | 
             
              s.homepage = %q{http://github.com/ilpoldo/connie}
         | 
| 64 64 | 
             
              s.licenses = ["MIT"]
         | 
| 65 65 | 
             
              s.require_paths = ["lib"]
         | 
| 66 | 
            -
              s.rubygems_version = %q{1. | 
| 66 | 
            +
              s.rubygems_version = %q{1.3.6}
         | 
| 67 67 | 
             
              s.summary = %q{Little compact library to synthesise data that does not load big files in memory}
         | 
| 68 | 
            -
              s.test_files = [
         | 
| 69 | 
            -
                "spec/connie_spec.rb",
         | 
| 70 | 
            -
                "spec/spec_helper.rb"
         | 
| 71 | 
            -
              ]
         | 
| 72 68 |  | 
| 73 69 | 
             
              if s.respond_to? :specification_version then
         | 
| 70 | 
            +
                current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
         | 
| 74 71 | 
             
                s.specification_version = 3
         | 
| 75 72 |  | 
| 76 | 
            -
                if Gem::Version.new(Gem:: | 
| 77 | 
            -
                  s.add_development_dependency(%q<rspec>, [" | 
| 78 | 
            -
                  s.add_development_dependency(%q< | 
| 79 | 
            -
                  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
         | 
| 73 | 
            +
                if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
         | 
| 74 | 
            +
                  s.add_development_dependency(%q<rspec>, [">= 0"])
         | 
| 75 | 
            +
                  s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
         | 
| 80 76 | 
             
                  s.add_development_dependency(%q<rcov>, [">= 0"])
         | 
| 81 77 | 
             
                else
         | 
| 82 | 
            -
                  s.add_dependency(%q<rspec>, [" | 
| 83 | 
            -
                  s.add_dependency(%q< | 
| 84 | 
            -
                  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
         | 
| 78 | 
            +
                  s.add_dependency(%q<rspec>, [">= 0"])
         | 
| 79 | 
            +
                  s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
         | 
| 85 80 | 
             
                  s.add_dependency(%q<rcov>, [">= 0"])
         | 
| 86 81 | 
             
                end
         | 
| 87 82 | 
             
              else
         | 
| 88 | 
            -
                s.add_dependency(%q<rspec>, [" | 
| 89 | 
            -
                s.add_dependency(%q< | 
| 90 | 
            -
                s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
         | 
| 83 | 
            +
                s.add_dependency(%q<rspec>, [">= 0"])
         | 
| 84 | 
            +
                s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
         | 
| 91 85 | 
             
                s.add_dependency(%q<rcov>, [">= 0"])
         | 
| 92 86 | 
             
              end
         | 
| 93 87 | 
             
            end
         | 
    
        data/lib/connie.rb
    CHANGED
    
    | @@ -4,6 +4,7 @@ require 'connie/parser' | |
| 4 4 |  | 
| 5 5 |  | 
| 6 6 | 
             
            module Connie
         | 
| 7 | 
            +
              
         | 
| 7 8 | 
             
              # class Railtie < Rails::Railtie
         | 
| 8 9 | 
             
              #   config.tabelle = ActiveSupport::OrderedOptions.new
         | 
| 9 10 | 
             
              # 
         | 
| @@ -21,6 +22,11 @@ module Connie | |
| 21 22 | 
             
              # end
         | 
| 22 23 | 
             
              @dictionaries_paths = [File.expand_path('dictionaries',File.dirname(__FILE__))]
         | 
| 23 24 | 
             
              VERSION = File.exist?('VERSION') ? File.read('VERSION') : ""
         | 
| 25 | 
            +
              
         | 
| 26 | 
            +
              def self.dictionaries_paths
         | 
| 27 | 
            +
                @dictionaries_paths
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
              
         | 
| 24 30 | 
             
            end
         | 
| 25 31 |  | 
| 26 32 | 
             
            # The shorthand method to use connie
         | 
    
        data/lib/connie/connie.rb
    CHANGED
    
    
    
        data/lib/connie/parser.rb
    CHANGED
    
    | @@ -5,7 +5,7 @@ module Connie | |
| 5 5 | 
             
                attr_accessor :dictionary
         | 
| 6 6 |  | 
| 7 7 | 
             
                @syntax = {# :method or :dictionary.method
         | 
| 8 | 
            -
                           %r{((?:[\\] | 
| 8 | 
            +
                           %r{((?:[\\])?\:[a-z]\w+(?:\.\w+)?)} => lambda do |dictionary_and_method|
         | 
| 9 9 | 
             
                            arguments = dictionary_and_method[1..-1].split('.').map &:to_sym
         | 
| 10 10 | 
             
                            case arguments.size
         | 
| 11 11 | 
             
                            when 2 then Connie[arguments[0]].send arguments[1]
         | 
| @@ -13,15 +13,14 @@ module Connie | |
| 13 13 | 
             
                            end
         | 
| 14 14 | 
             
                           end,
         | 
| 15 15 | 
             
                           # :d - one digit
         | 
| 16 | 
            -
                           %r{((?:[\\] | 
| 16 | 
            +
                           %r{((?:[\\])?\:[wWd])(?:[^\w\{])} => lambda do |letter_or_digit|
         | 
| 17 17 | 
             
                            Connie.formats letter_or_digit[1].to_sym
         | 
| 18 18 | 
             
                           end,
         | 
| 19 19 | 
             
                           # :w{2,4} - two to four letters
         | 
| 20 | 
            -
                           %r{((?:[\\] | 
| 20 | 
            +
                           %r{((?:[\\])?\:[wWd](?:\{\d+(?:,\d+)?\}))} => lambda do |character_and_frequency|
         | 
| 21 21 | 
             
                            character, f_min, f_max = character_and_frequency[1..-1].match(%r{(\w)(?:\{(\d+)(?:,(\d+))?\})})[1..-1]
         | 
| 22 22 | 
             
                            Connie.formats character.to_sym, f_min.to_i, f_max.to_i
         | 
| 23 23 | 
             
                           end
         | 
| 24 | 
            -
                           
         | 
| 25 24 | 
             
                          }
         | 
| 26 25 |  | 
| 27 26 | 
             
                def self.process string_to_parse, dictionary = Connie[:names]
         | 
    
        data/spec/connie_spec.rb
    CHANGED
    
    | @@ -10,13 +10,16 @@ describe Connie, 'api' do | |
| 10 10 | 
             
                Connie(:'names.male').should eql('Mark')
         | 
| 11 11 | 
             
              end
         | 
| 12 12 |  | 
| 13 | 
            -
              it "returns a dictionary using the shorthand" do
         | 
| 14 | 
            -
                Connie(:names) | 
| 13 | 
            +
              it "returns a dictionary using the () shorthand" do
         | 
| 14 | 
            +
                dictionary = Connie(:names)
         | 
| 15 | 
            +
                dictionary.class.should eql(Connie::Dictionary)
         | 
| 16 | 
            +
                dictionary.male.should eql('Mark')
         | 
| 15 17 | 
             
              end
         | 
| 16 18 |  | 
| 17 19 | 
             
              it "returns a dictionary using []" do
         | 
| 18 | 
            -
                 | 
| 19 | 
            -
                 | 
| 20 | 
            +
                dictionary = Connie[:names]
         | 
| 21 | 
            +
                dictionary.class.should eql(Connie::Dictionary)
         | 
| 22 | 
            +
                dictionary.male.should eql('Mark')
         | 
| 20 23 | 
             
              end
         | 
| 21 24 |  | 
| 22 25 | 
             
              it "parses a string passed" do
         | 
| @@ -64,7 +67,7 @@ describe Connie, 'api' do | |
| 64 67 |  | 
| 65 68 | 
             
                  module Address
         | 
| 66 69 | 
             
                    def name_and_where
         | 
| 67 | 
            -
                      interpolate ":names. | 
| 70 | 
            +
                      interpolate ":names.male :names.last :geo.where"
         | 
| 68 71 | 
             
                    end
         | 
| 69 72 | 
             
                  end
         | 
| 70 73 | 
             
                end
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,12 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: connie
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
               | 
| 5 | 
            -
              prerelease: 
         | 
| 4 | 
            +
              prerelease: false
         | 
| 6 5 | 
             
              segments: 
         | 
| 7 6 | 
             
              - 0
         | 
| 8 7 | 
             
              - 1
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 0.1. | 
| 8 | 
            +
              - 1
         | 
| 9 | 
            +
              version: 0.1.1
         | 
| 11 10 | 
             
            platform: ruby
         | 
| 12 11 | 
             
            authors: 
         | 
| 13 12 | 
             
            - Leandro Pedroni
         | 
| @@ -15,70 +14,47 @@ autorequire: | |
| 15 14 | 
             
            bindir: bin
         | 
| 16 15 | 
             
            cert_chain: []
         | 
| 17 16 |  | 
| 18 | 
            -
            date: 2011- | 
| 17 | 
            +
            date: 2011-10-02 00:00:00 +01:00
         | 
| 18 | 
            +
            default_executable: 
         | 
| 19 19 | 
             
            dependencies: 
         | 
| 20 20 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 21 21 | 
             
              requirement: &id001 !ruby/object:Gem::Requirement 
         | 
| 22 | 
            -
                none: false
         | 
| 23 22 | 
             
                requirements: 
         | 
| 24 | 
            -
                - -  | 
| 23 | 
            +
                - - ">="
         | 
| 25 24 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 26 | 
            -
                    hash: 3
         | 
| 27 25 | 
             
                    segments: 
         | 
| 28 | 
            -
                    - 2
         | 
| 29 | 
            -
                    - 3
         | 
| 30 26 | 
             
                    - 0
         | 
| 31 | 
            -
                    version:  | 
| 32 | 
            -
              version_requirements: *id001
         | 
| 33 | 
            -
              name: rspec
         | 
| 27 | 
            +
                    version: "0"
         | 
| 34 28 | 
             
              prerelease: false
         | 
| 35 29 | 
             
              type: :development
         | 
| 30 | 
            +
              name: rspec
         | 
| 31 | 
            +
              version_requirements: *id001
         | 
| 36 32 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 37 33 | 
             
              requirement: &id002 !ruby/object:Gem::Requirement 
         | 
| 38 | 
            -
                none: false
         | 
| 39 34 | 
             
                requirements: 
         | 
| 40 35 | 
             
                - - ~>
         | 
| 41 36 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 42 | 
            -
                    hash: 23
         | 
| 43 37 | 
             
                    segments: 
         | 
| 44 38 | 
             
                    - 1
         | 
| 39 | 
            +
                    - 6
         | 
| 45 40 | 
             
                    - 0
         | 
| 46 | 
            -
                     | 
| 47 | 
            -
                    version: 1.0.0
         | 
| 48 | 
            -
              version_requirements: *id002
         | 
| 49 | 
            -
              name: bundler
         | 
| 41 | 
            +
                    version: 1.6.0
         | 
| 50 42 | 
             
              prerelease: false
         | 
| 51 43 | 
             
              type: :development
         | 
| 52 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 53 | 
            -
              requirement: &id003 !ruby/object:Gem::Requirement 
         | 
| 54 | 
            -
                none: false
         | 
| 55 | 
            -
                requirements: 
         | 
| 56 | 
            -
                - - ~>
         | 
| 57 | 
            -
                  - !ruby/object:Gem::Version 
         | 
| 58 | 
            -
                    hash: 7
         | 
| 59 | 
            -
                    segments: 
         | 
| 60 | 
            -
                    - 1
         | 
| 61 | 
            -
                    - 5
         | 
| 62 | 
            -
                    - 2
         | 
| 63 | 
            -
                    version: 1.5.2
         | 
| 64 | 
            -
              version_requirements: *id003
         | 
| 65 44 | 
             
              name: jeweler
         | 
| 66 | 
            -
               | 
| 67 | 
            -
              type: :development
         | 
| 45 | 
            +
              version_requirements: *id002
         | 
| 68 46 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 69 | 
            -
              requirement: & | 
| 70 | 
            -
                none: false
         | 
| 47 | 
            +
              requirement: &id003 !ruby/object:Gem::Requirement 
         | 
| 71 48 | 
             
                requirements: 
         | 
| 72 49 | 
             
                - - ">="
         | 
| 73 50 | 
             
                  - !ruby/object:Gem::Version 
         | 
| 74 | 
            -
                    hash: 3
         | 
| 75 51 | 
             
                    segments: 
         | 
| 76 52 | 
             
                    - 0
         | 
| 77 53 | 
             
                    version: "0"
         | 
| 78 | 
            -
              version_requirements: *id004
         | 
| 79 | 
            -
              name: rcov
         | 
| 80 54 | 
             
              prerelease: false
         | 
| 81 55 | 
             
              type: :development
         | 
| 56 | 
            +
              name: rcov
         | 
| 57 | 
            +
              version_requirements: *id003
         | 
| 82 58 | 
             
            description: Heavily based on Forgery it uses the same word sources. It's built to be a bit more customisable and allows you to define new strategies and styles both using ruby modules or big text lists.
         | 
| 83 59 | 
             
            email: ilpoldo@gmail.com
         | 
| 84 60 | 
             
            executables: []
         | 
| @@ -131,6 +107,7 @@ files: | |
| 131 107 | 
             
            - spec/spec_helper.rb
         | 
| 132 108 | 
             
            - spec/test_dictionaries/names/male
         | 
| 133 109 | 
             
            - spec/test_dictionaries/numbers/ordinal
         | 
| 110 | 
            +
            has_rdoc: true
         | 
| 134 111 | 
             
            homepage: http://github.com/ilpoldo/connie
         | 
| 135 112 | 
             
            licenses: 
         | 
| 136 113 | 
             
            - MIT
         | 
| @@ -140,30 +117,25 @@ rdoc_options: [] | |
| 140 117 | 
             
            require_paths: 
         | 
| 141 118 | 
             
            - lib
         | 
| 142 119 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 143 | 
            -
              none: false
         | 
| 144 120 | 
             
              requirements: 
         | 
| 145 121 | 
             
              - - ">="
         | 
| 146 122 | 
             
                - !ruby/object:Gem::Version 
         | 
| 147 | 
            -
                  hash: 3
         | 
| 148 123 | 
             
                  segments: 
         | 
| 149 124 | 
             
                  - 0
         | 
| 150 125 | 
             
                  version: "0"
         | 
| 151 126 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 152 | 
            -
              none: false
         | 
| 153 127 | 
             
              requirements: 
         | 
| 154 128 | 
             
              - - ">="
         | 
| 155 129 | 
             
                - !ruby/object:Gem::Version 
         | 
| 156 | 
            -
                  hash: 3
         | 
| 157 130 | 
             
                  segments: 
         | 
| 158 131 | 
             
                  - 0
         | 
| 159 132 | 
             
                  version: "0"
         | 
| 160 133 | 
             
            requirements: []
         | 
| 161 134 |  | 
| 162 135 | 
             
            rubyforge_project: 
         | 
| 163 | 
            -
            rubygems_version: 1. | 
| 136 | 
            +
            rubygems_version: 1.3.6
         | 
| 164 137 | 
             
            signing_key: 
         | 
| 165 138 | 
             
            specification_version: 3
         | 
| 166 139 | 
             
            summary: Little compact library to synthesise data that does not load big files in memory
         | 
| 167 | 
            -
            test_files: 
         | 
| 168 | 
            -
             | 
| 169 | 
            -
            - spec/spec_helper.rb
         | 
| 140 | 
            +
            test_files: []
         | 
| 141 | 
            +
             |