file-visitor 0.2.0 → 0.3.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/README.md +2 -1
- data/lib/file/visitor/filter/ext.rb +21 -9
- data/lib/file/visitor/version.rb +1 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 4a578d6d010b47bdee7e6afe8a360a47cdfdca71
         | 
| 4 | 
            +
              data.tar.gz: d54bf6b9bda3ffed3410ea8255318f2de0cd6b7d
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: df0d33f6c59e6bcc3877482d7a6298c142fa3dcf6802bd45d7324cabba729673a57749b61afb391f4ca02e7629c18fa0686d759396592a722aae56d9497ddef9
         | 
| 7 | 
            +
              data.tar.gz: 2eacd0ad5b60c15c9b8f0350195284b2191c8b2347ba69a7db6c87d029219ba463a53b278bf0b24ffd7411d942a076b26eb556f8e19b81a19c81fe1d15baf640
         | 
    
        data/README.md
    CHANGED
    
    
| @@ -3,24 +3,36 @@ require 'file/visitor/filter' | |
| 3 3 |  | 
| 4 4 | 
             
            class File::Visitor::Filter::Ext
         | 
| 5 5 |  | 
| 6 | 
            -
                def initialize( | 
| 7 | 
            -
                  if  | 
| 8 | 
            -
                     | 
| 6 | 
            +
                def initialize(ext)
         | 
| 7 | 
            +
                  if ext.is_a?(Array)
         | 
| 8 | 
            +
                    @extentions = ext
         | 
| 9 | 
            +
                  elsif ext.nil?
         | 
| 10 | 
            +
                    raise ArgumentError, "ext is nil"
         | 
| 11 | 
            +
                  else
         | 
| 12 | 
            +
                    @extentions = [ext]
         | 
| 9 13 | 
             
                  end
         | 
| 10 | 
            -
             | 
| 11 | 
            -
                   | 
| 12 | 
            -
                     | 
| 14 | 
            +
             | 
| 15 | 
            +
                  @extentions = @extentions.map do |extention|
         | 
| 16 | 
            +
                    if extention.nil? ||
         | 
| 17 | 
            +
                      !(extention.is_a?(String) || extention.is_a?(Symbol))
         | 
| 18 | 
            +
                      raise ArgumentError, "ext must be Sting/Symbol."
         | 
| 19 | 
            +
                    end
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                    extention = extention.to_s
         | 
| 22 | 
            +
                    unless extention =~ /\A\./
         | 
| 23 | 
            +
                      extention = ".#{extention}"
         | 
| 24 | 
            +
                    end
         | 
| 25 | 
            +
                    extention
         | 
| 13 26 | 
             
                  end
         | 
| 14 | 
            -
                  @ext = extstr
         | 
| 15 27 | 
             
                end
         | 
| 16 28 |  | 
| 17 29 | 
             
                def match?(path)
         | 
| 18 30 | 
             
                  ext = File.extname(path)
         | 
| 19 | 
            -
                  ext ==  | 
| 31 | 
            +
                  @extentions.any? { |fext| ext == fext }
         | 
| 20 32 | 
             
                end
         | 
| 21 33 |  | 
| 22 34 | 
             
                def to_s
         | 
| 23 | 
            -
                  "%s[%s]" % [self.class.name, @ | 
| 35 | 
            +
                  "%s[%s]" % [self.class.name, @extentions.join(',')]
         | 
| 24 36 | 
             
                end
         | 
| 25 37 |  | 
| 26 38 | 
             
            end
         | 
    
        data/lib/file/visitor/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: file-visitor
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.3.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - bonar
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2016- | 
| 11 | 
            +
            date: 2016-10-21 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 101 101 | 
             
                  version: '0'
         | 
| 102 102 | 
             
            requirements: []
         | 
| 103 103 | 
             
            rubyforge_project: 
         | 
| 104 | 
            -
            rubygems_version: 2. | 
| 104 | 
            +
            rubygems_version: 2.5.1
         | 
| 105 105 | 
             
            signing_key: 
         | 
| 106 106 | 
             
            specification_version: 4
         | 
| 107 107 | 
             
            summary: File path collectiong utility
         |