rss-ox 0.0.2
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 +15 -0
 - data/.gitignore +18 -0
 - data/LICENSE +22 -0
 - data/README.md +4 -0
 - data/lib/rss/ox.rb +82 -0
 - data/rss-ox.gemspec +13 -0
 - metadata +62 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            !binary "U0hBMQ==":
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: !binary |-
         
     | 
| 
      
 4 
     | 
    
         
            +
                YWZmOGU3ZDZhMWI2NjRmOTk2MjJjNWZkZGRkN2Y4N2NlZjIyNWM1OA==
         
     | 
| 
      
 5 
     | 
    
         
            +
              data.tar.gz: !binary |-
         
     | 
| 
      
 6 
     | 
    
         
            +
                Mjg5Y2JhNWE3MjcyYzU2ZGY3NGI2MjBlNzcyNGYwMmRmZDNhMzhjMQ==
         
     | 
| 
      
 7 
     | 
    
         
            +
            !binary "U0hBNTEy":
         
     | 
| 
      
 8 
     | 
    
         
            +
              metadata.gz: !binary |-
         
     | 
| 
      
 9 
     | 
    
         
            +
                MWFkMjVhZjQwYzJhOTNmZWQzMjQzNDlkNDJhMzg0ZTMwZDBlODljMmQxMTMz
         
     | 
| 
      
 10 
     | 
    
         
            +
                MjI4ZmE4ODY5NmY2MTljNmFiYTRlY2I2ZDkyNGJjMGI4MjUyMThmMzcyMzQw
         
     | 
| 
      
 11 
     | 
    
         
            +
                ZGFiNDFjYTU0YTU4NzVmYWUzYWFhZDEzY2QyZmE1YWZjODQ0NDY=
         
     | 
| 
      
 12 
     | 
    
         
            +
              data.tar.gz: !binary |-
         
     | 
| 
      
 13 
     | 
    
         
            +
                YjUxNjZmNTgxYzc4NDRlMTEwNjQyZmRlMTMwYzNiNDNhNjVmNTA5MTI5ZDIy
         
     | 
| 
      
 14 
     | 
    
         
            +
                NzY4YWFiNzRjMjNhNjJmZWU4MTQzYTRmYTUxOGFlM2E4MzhiZTc3ZDZiN2Vh
         
     | 
| 
      
 15 
     | 
    
         
            +
                ZmM5ZGVkMWEwMDNjMjFiZDdhNjJiYTFjMTgyMzBiYmUxOTI4YTM=
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/LICENSE
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright (c) 2013 notezen
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            MIT License
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 6 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 7 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 8 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 9 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 10 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 11 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 14 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 17 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 18 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 19 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 20 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 21 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 22 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    
    
        data/lib/rss/ox.rb
    ADDED
    
    | 
         @@ -0,0 +1,82 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rss'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module RSS
         
     | 
| 
      
 4 
     | 
    
         
            +
              class OxParser < BaseParser
         
     | 
| 
      
 5 
     | 
    
         
            +
                def self.listener
         
     | 
| 
      
 6 
     | 
    
         
            +
                  OxListener
         
     | 
| 
      
 7 
     | 
    
         
            +
                end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                private
         
     | 
| 
      
 10 
     | 
    
         
            +
                def _parse
         
     | 
| 
      
 11 
     | 
    
         
            +
                  Ox.sax_parse(@listener, StringIO.new(@rss), :convert_special => true)
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              class OxListener < BaseListener
         
     | 
| 
      
 16 
     | 
    
         
            +
                include ListenerMixin
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                def instruct(target)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @attr={}
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                def end_instruct(target)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  if target == 'xml'
         
     | 
| 
      
 24 
     | 
    
         
            +
                    xmldecl(@attr['version'], nil, @attr['standalone'] == 'yes')
         
     | 
| 
      
 25 
     | 
    
         
            +
                    if @attr['encoding']
         
     | 
| 
      
 26 
     | 
    
         
            +
                      @xml_enc = @attr['encoding']
         
     | 
| 
      
 27 
     | 
    
         
            +
                      @encoding = 'UTF-8'
         
     | 
| 
      
 28 
     | 
    
         
            +
                    end
         
     | 
| 
      
 29 
     | 
    
         
            +
                  else
         
     | 
| 
      
 30 
     | 
    
         
            +
                    content=''
         
     | 
| 
      
 31 
     | 
    
         
            +
                    @attr.each { |k,v| content<<"#{k}=\"#{v}\" " }
         
     | 
| 
      
 32 
     | 
    
         
            +
                    instruction target, content
         
     | 
| 
      
 33 
     | 
    
         
            +
                  end
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                def attr(name, str)
         
     | 
| 
      
 37 
     | 
    
         
            +
                  @attr[name.to_s] = str
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                def doctype(str); end
         
     | 
| 
      
 41 
     | 
    
         
            +
                def comment(str); end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
                def cdata(str)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  text(str)
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                def text(str)
         
     | 
| 
      
 48 
     | 
    
         
            +
                  ensure_start
         
     | 
| 
      
 49 
     | 
    
         
            +
                  str.encode!(@encoding,@xml_enc) if @xml_enc
         
     | 
| 
      
 50 
     | 
    
         
            +
                  super(str)
         
     | 
| 
      
 51 
     | 
    
         
            +
                end
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                def start_element(name)
         
     | 
| 
      
 54 
     | 
    
         
            +
                  ensure_start
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                  @attr = {}
         
     | 
| 
      
 57 
     | 
    
         
            +
                  @started = name
         
     | 
| 
      
 58 
     | 
    
         
            +
                end
         
     | 
| 
      
 59 
     | 
    
         
            +
                def end_element(name)
         
     | 
| 
      
 60 
     | 
    
         
            +
                  ensure_start
         
     | 
| 
      
 61 
     | 
    
         
            +
                  tag_end name
         
     | 
| 
      
 62 
     | 
    
         
            +
                end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                private
         
     | 
| 
      
 65 
     | 
    
         
            +
                def ensure_start
         
     | 
| 
      
 66 
     | 
    
         
            +
                  if @started
         
     | 
| 
      
 67 
     | 
    
         
            +
                    tag_start @started, @attr
         
     | 
| 
      
 68 
     | 
    
         
            +
                    @started = nil
         
     | 
| 
      
 69 
     | 
    
         
            +
                  end
         
     | 
| 
      
 70 
     | 
    
         
            +
                end
         
     | 
| 
      
 71 
     | 
    
         
            +
              end
         
     | 
| 
      
 72 
     | 
    
         
            +
             
     | 
| 
      
 73 
     | 
    
         
            +
              begin
         
     | 
| 
      
 74 
     | 
    
         
            +
                lib = 'ox'
         
     | 
| 
      
 75 
     | 
    
         
            +
                require lib
         
     | 
| 
      
 76 
     | 
    
         
            +
                AVAILABLE_PARSER_LIBRARIES << ['rss/ox', :OxParser]
         
     | 
| 
      
 77 
     | 
    
         
            +
                AVAILABLE_PARSERS << OxParser
         
     | 
| 
      
 78 
     | 
    
         
            +
                Parser.default_parser = OxParser
         
     | 
| 
      
 79 
     | 
    
         
            +
              rescue LoadError
         
     | 
| 
      
 80 
     | 
    
         
            +
                warn "Couldn't load #{lib}. Falled back to the default parser(#{Parser.default_parser})."
         
     | 
| 
      
 81 
     | 
    
         
            +
              end
         
     | 
| 
      
 82 
     | 
    
         
            +
            end
         
     | 
    
        data/rss-ox.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Gem::Specification.new do |s|
         
     | 
| 
      
 2 
     | 
    
         
            +
              s.name = "rss-ox"
         
     | 
| 
      
 3 
     | 
    
         
            +
              s.version = "0.0.2"
         
     | 
| 
      
 4 
     | 
    
         
            +
              s.license = 'MIT'
         
     | 
| 
      
 5 
     | 
    
         
            +
              s.authors = "notezen"
         
     | 
| 
      
 6 
     | 
    
         
            +
              s.email = "notezen@gmail.com"
         
     | 
| 
      
 7 
     | 
    
         
            +
              s.homepage = "https://github.com/notezen/rss-ox"
         
     | 
| 
      
 8 
     | 
    
         
            +
              s.summary = "Ox parser for Ruby's RSS library"
         
     | 
| 
      
 9 
     | 
    
         
            +
              s.description = "Parse RSS/Atom feeds with Ox and Ruby's stdlib"
         
     | 
| 
      
 10 
     | 
    
         
            +
              s.files = `git ls-files`.split($\)
         
     | 
| 
      
 11 
     | 
    
         
            +
              s.require_paths = ["lib"]
         
     | 
| 
      
 12 
     | 
    
         
            +
              s.add_dependency "ox"
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,62 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: rss-ox
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.2
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - notezen
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2013-04-25 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: ox
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 27 
     | 
    
         
            +
            description: Parse RSS/Atom feeds with Ox and Ruby's stdlib
         
     | 
| 
      
 28 
     | 
    
         
            +
            email: notezen@gmail.com
         
     | 
| 
      
 29 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 30 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 31 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 32 
     | 
    
         
            +
            files:
         
     | 
| 
      
 33 
     | 
    
         
            +
            - .gitignore
         
     | 
| 
      
 34 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 35 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 36 
     | 
    
         
            +
            - lib/rss/ox.rb
         
     | 
| 
      
 37 
     | 
    
         
            +
            - rss-ox.gemspec
         
     | 
| 
      
 38 
     | 
    
         
            +
            homepage: https://github.com/notezen/rss-ox
         
     | 
| 
      
 39 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 40 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 41 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 42 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 43 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 44 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 45 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 46 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 47 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 48 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 49 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 50 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 51 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 52 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 53 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 54 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 55 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 56 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 57 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 58 
     | 
    
         
            +
            rubygems_version: 2.0.3
         
     | 
| 
      
 59 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 60 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 61 
     | 
    
         
            +
            summary: Ox parser for Ruby's RSS library
         
     | 
| 
      
 62 
     | 
    
         
            +
            test_files: []
         
     |