dom_render 0.1.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 +7 -0
 - checksums.yaml.gz.sig +0 -0
 - data/lib/dom_render.rb +35 -0
 - data.tar.gz.sig +2 -0
 - metadata +87 -0
 - metadata.gz.sig +0 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 3b111ad32001c12e2510711eb35414baeffdf502
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 5a02a94f99513c2f367b6e50027bc387af5dd3a6
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4b3dd51f2f35465688e3d1dd10c38dd55027801f6a0580b30d1caa330024c54039a16885e3b50d821aa7aba5327d6e78b6b33e8610d7c3e88fbbc30634cf4fe7
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 9461c89f58d9964a057511afceaed79ef18a21c2040f5ce63473d1b52481aaa2561b0de191f56fce158b00c31f9fbf83c841f00742bb2370834f9dcfb8712ab2
         
     | 
    
        checksums.yaml.gz.sig
    ADDED
    
    | 
         Binary file 
     | 
    
        data/lib/dom_render.rb
    ADDED
    
    | 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # file: dom_render.rb
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            require 'rexle'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            class DomRender
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              attr_reader :to_a
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              def initialize(s)
         
     | 
| 
      
 13 
     | 
    
         
            +
                @to_a = render Rexle.new(s).root
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              def render(x)
         
     | 
| 
      
 17 
     | 
    
         
            +
                method(x.name.to_sym).call(x)
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              def render_all(x)
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                len = x.children.length - 1
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                x.children.map.with_index do |obj,i|
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  if obj.is_a? String then
         
     | 
| 
      
 27 
     | 
    
         
            +
                    i == 0 ? obj.lstrip.sub(/\s+$/,' ') : obj.rstrip.sub(/^\s+/,' ')
         
     | 
| 
      
 28 
     | 
    
         
            +
                  elsif obj.is_a? Rexle::Element
         
     | 
| 
      
 29 
     | 
    
         
            +
                    render obj
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
    
        data.tar.gz.sig
    ADDED
    
    
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,87 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: dom_render
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - James Robertson
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain:
         
     | 
| 
      
 11 
     | 
    
         
            +
            - |
         
     | 
| 
      
 12 
     | 
    
         
            +
              -----BEGIN CERTIFICATE-----
         
     | 
| 
      
 13 
     | 
    
         
            +
              MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
         
     | 
| 
      
 14 
     | 
    
         
            +
              YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
         
     | 
| 
      
 15 
     | 
    
         
            +
              8ixkARkWAmV1MB4XDTE1MTEwOTE3MTQwOFoXDTE2MTEwODE3MTQwOFowSDESMBAG
         
     | 
| 
      
 16 
     | 
    
         
            +
              A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
         
     | 
| 
      
 17 
     | 
    
         
            +
              EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
         
     | 
| 
      
 18 
     | 
    
         
            +
              ggEBAN8219P82aeJWwvjgXuq8yGWSEkWwPUbYCHkV9DYGLU6tuKpqdzmLIl5KLbu
         
     | 
| 
      
 19 
     | 
    
         
            +
              fZn+j+L8cbbLXNO24mlgBTS8Vzks5JBx0V43PFOOxBwAfOpZceNLt9Ne/YQEC/82
         
     | 
| 
      
 20 
     | 
    
         
            +
              bsaQeS+qFP5KsVFGIyDxOiggntN68GInbkG7NFom+qD5i/Y9IvNS4u9mjRPrnJd6
         
     | 
| 
      
 21 
     | 
    
         
            +
              9fcb4UDDH69A2KgLA3xEG67+auPs/lUAO6fQCVGMoDwBDE4ecY3sjJaGoqAPcyhU
         
     | 
| 
      
 22 
     | 
    
         
            +
              tbh11I/IJo9AtEMCFVMH3YzJt/OocRxnKn3PgM2FShq5sIhnwkrEqUVhyUl0ln1P
         
     | 
| 
      
 23 
     | 
    
         
            +
              ONr2uZ188RBN/1+pcZEGuujzaHMCAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
         
     | 
| 
      
 24 
     | 
    
         
            +
              DwQEAwIEsDAdBgNVHQ4EFgQUvDXV2oj31s5fCWjzGc6CTJbfgRswJgYDVR0RBB8w
         
     | 
| 
      
 25 
     | 
    
         
            +
              HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
         
     | 
| 
      
 26 
     | 
    
         
            +
              c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAkdHBmzVP
         
     | 
| 
      
 27 
     | 
    
         
            +
              ddAtQgz9Xx8/MJYA/xcg59l9y/56cbMDwAMwSF/wUgv6iyYD8JT4wqhp8+TtLGeN
         
     | 
| 
      
 28 
     | 
    
         
            +
              3fGc9XXvQCnpekJjba1Uw/bCEXyvI7wtNocnZLpAUgyizO3sPYJJQotgMl6vfAzd
         
     | 
| 
      
 29 
     | 
    
         
            +
              xQ731arNAnFyd5CTJhDvooqlG4Vju6ZQE/rxL8rXHZPH8kGdhdNt/ZyHJgzZjyDy
         
     | 
| 
      
 30 
     | 
    
         
            +
              xpeSt8VY27XGo+W5SM+lS56FFZXfoEvaV+ktVm9l7BbUyYPiGJMFU1SVMvqHlt7y
         
     | 
| 
      
 31 
     | 
    
         
            +
              ipCgMpSHSTGoxQ/dI853bcb+vPkAqS69GEcZgtvAmCQs5E4KC1seYLuP3qtuatL9
         
     | 
| 
      
 32 
     | 
    
         
            +
              dbkCMOVMy0htMQ==
         
     | 
| 
      
 33 
     | 
    
         
            +
              -----END CERTIFICATE-----
         
     | 
| 
      
 34 
     | 
    
         
            +
            date: 2015-11-09 00:00:00.000000000 Z
         
     | 
| 
      
 35 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 36 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 37 
     | 
    
         
            +
              name: rexle
         
     | 
| 
      
 38 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 39 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 40 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 41 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 42 
     | 
    
         
            +
                    version: '1.3'
         
     | 
| 
      
 43 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 44 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 45 
     | 
    
         
            +
                    version: 1.3.9
         
     | 
| 
      
 46 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 47 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 48 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 49 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 50 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 51 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 52 
     | 
    
         
            +
                    version: '1.3'
         
     | 
| 
      
 53 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 54 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 55 
     | 
    
         
            +
                    version: 1.3.9
         
     | 
| 
      
 56 
     | 
    
         
            +
            description: 
         
     | 
| 
      
 57 
     | 
    
         
            +
            email: james@r0bertson.co.uk
         
     | 
| 
      
 58 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 59 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 60 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 61 
     | 
    
         
            +
            files:
         
     | 
| 
      
 62 
     | 
    
         
            +
            - lib/dom_render.rb
         
     | 
| 
      
 63 
     | 
    
         
            +
            homepage: https://github.com/jrobertson/dom_render
         
     | 
| 
      
 64 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 65 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 66 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 67 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 68 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 69 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 70 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 71 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 74 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 76 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 77 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 78 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 79 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 80 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 81 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 82 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 83 
     | 
    
         
            +
            rubygems_version: 2.4.8
         
     | 
| 
      
 84 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 85 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 86 
     | 
    
         
            +
            summary: Designed to render HTML
         
     | 
| 
      
 87 
     | 
    
         
            +
            test_files: []
         
     | 
    
        metadata.gz.sig
    ADDED
    
    | 
         Binary file 
     |