nokolexbor 0.3.2-x64-mingw32 → 0.3.4-x64-mingw32
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/lib/nokolexbor/2.6/nokolexbor.so +0 -0
- data/lib/nokolexbor/2.7/nokolexbor.so +0 -0
- data/lib/nokolexbor/3.0/nokolexbor.so +0 -0
- data/lib/nokolexbor/document_fragment.rb +31 -0
- data/lib/nokolexbor/node.rb +7 -6
- data/lib/nokolexbor/version.rb +1 -1
- data/lib/nokolexbor.rb +1 -1
- metadata +3 -3
- data/lib/nokolexbor/attribute.rb +0 -18
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 00ba26b83d2040a2a0a1334edebf3c0f3210801170de093a66eb8583a142d14f
         | 
| 4 | 
            +
              data.tar.gz: 3a38ddeb389c6da448a66e64dbf2bee707683ff50a22c0d150bc5aeaed4838db
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 974d81de8d825e62399894b62bbd0aeb1fee10d762d2d4b5ccf95b7674fcb2a483be52a82f1c8b737efb9a2052c0e0636c8f52b726621a19f8731bd9c9f2628b
         | 
| 7 | 
            +
              data.tar.gz: 7738264633cffce68333ef16903afb82102c93f104d840d9b561e8f0e82cadd9e16d0b29b9e98290e4fa0726178bf3cf96c7ac16d7e31c614354b52eaa8c0e77
         | 
| Binary file | 
| Binary file | 
| Binary file | 
| @@ -0,0 +1,31 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Nokolexbor
         | 
| 4 | 
            +
              class DocumentFragment < Nokolexbor::Node
         | 
| 5 | 
            +
                def self.parse(tags)
         | 
| 6 | 
            +
                  new(Nokolexbor::Document.new, tags, nil)
         | 
| 7 | 
            +
                end
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                def initialize(document, tags = nil, ctx = nil)
         | 
| 10 | 
            +
                  return self unless tags
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                  ctx ||= document
         | 
| 13 | 
            +
                  node_set = ctx.parse(tags)
         | 
| 14 | 
            +
                  node_set.each { |child| child.parent = self } unless node_set.empty?
         | 
| 15 | 
            +
                  nil
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                def name
         | 
| 19 | 
            +
                  "#document-fragment"
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                alias_method :outer_html, :inner_html
         | 
| 23 | 
            +
                alias_method :to_html, :outer_html
         | 
| 24 | 
            +
                alias_method :to_s, :outer_html
         | 
| 25 | 
            +
                alias_method :serialize, :outer_html
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                def fragment(data)
         | 
| 28 | 
            +
                  document.fragment(data)
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
            end
         | 
    
        data/lib/nokolexbor/node.rb
    CHANGED
    
    | @@ -145,13 +145,10 @@ module Nokolexbor | |
| 145 145 | 
             
                  ancestors.last.css(selector).any? { |node| node == self }
         | 
| 146 146 | 
             
                end
         | 
| 147 147 |  | 
| 148 | 
            -
                def attribute(name)
         | 
| 149 | 
            -
                  return nil unless key?(name)
         | 
| 150 | 
            -
                  Attribute.new(name, attr(name))
         | 
| 151 | 
            -
                end
         | 
| 152 | 
            -
             | 
| 153 148 | 
             
                def attributes
         | 
| 154 | 
            -
                   | 
| 149 | 
            +
                  attribute_nodes.each_with_object({}) do |node, hash|
         | 
| 150 | 
            +
                    hash[node.name] = node
         | 
| 151 | 
            +
                  end
         | 
| 155 152 | 
             
                end
         | 
| 156 153 |  | 
| 157 154 | 
             
                def replace(node)
         | 
| @@ -182,6 +179,10 @@ module Nokolexbor | |
| 182 179 | 
             
                  end
         | 
| 183 180 | 
             
                end
         | 
| 184 181 |  | 
| 182 | 
            +
                def fragment(tags)
         | 
| 183 | 
            +
                  Nokolexbor::DocumentFragment.new(document, tags, self)
         | 
| 184 | 
            +
                end
         | 
| 185 | 
            +
             | 
| 185 186 | 
             
                alias_method :inner_html=, :children=
         | 
| 186 187 |  | 
| 187 188 | 
             
                def css(*args)
         | 
    
        data/lib/nokolexbor/version.rb
    CHANGED
    
    
    
        data/lib/nokolexbor.rb
    CHANGED
    
    | @@ -25,7 +25,7 @@ require 'nokolexbor/version' | |
| 25 25 | 
             
            require 'nokolexbor/node'
         | 
| 26 26 | 
             
            require 'nokolexbor/document'
         | 
| 27 27 | 
             
            require 'nokolexbor/node_set'
         | 
| 28 | 
            -
            require 'nokolexbor/ | 
| 28 | 
            +
            require 'nokolexbor/document_fragment'
         | 
| 29 29 | 
             
            require 'nokolexbor/xpath'
         | 
| 30 30 | 
             
            require 'nokolexbor/xpath_context'
         | 
| 31 31 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: nokolexbor
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.3. | 
| 4 | 
            +
              version: 0.3.4
         | 
| 5 5 | 
             
            platform: x64-mingw32
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Yicheng Zhou
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2023-01- | 
| 11 | 
            +
            date: 2023-01-10 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rake-compiler
         | 
| @@ -49,8 +49,8 @@ files: | |
| 49 49 | 
             
            - lib/nokolexbor/2.6/nokolexbor.so
         | 
| 50 50 | 
             
            - lib/nokolexbor/2.7/nokolexbor.so
         | 
| 51 51 | 
             
            - lib/nokolexbor/3.0/nokolexbor.so
         | 
| 52 | 
            -
            - lib/nokolexbor/attribute.rb
         | 
| 53 52 | 
             
            - lib/nokolexbor/document.rb
         | 
| 53 | 
            +
            - lib/nokolexbor/document_fragment.rb
         | 
| 54 54 | 
             
            - lib/nokolexbor/node.rb
         | 
| 55 55 | 
             
            - lib/nokolexbor/node_set.rb
         | 
| 56 56 | 
             
            - lib/nokolexbor/version.rb
         | 
    
        data/lib/nokolexbor/attribute.rb
    DELETED
    
    | @@ -1,18 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            module Nokolexbor
         | 
| 4 | 
            -
              class Attribute
         | 
| 5 | 
            -
                attr_accessor :name
         | 
| 6 | 
            -
                attr_accessor :value
         | 
| 7 | 
            -
             | 
| 8 | 
            -
                def initialize(name, value)
         | 
| 9 | 
            -
                  @name = name
         | 
| 10 | 
            -
                  @value = value
         | 
| 11 | 
            -
                end
         | 
| 12 | 
            -
             | 
| 13 | 
            -
                alias_method :text, :value
         | 
| 14 | 
            -
                alias_method :content, :value
         | 
| 15 | 
            -
                alias_method :to_s, :value
         | 
| 16 | 
            -
                alias_method :to_str, :value
         | 
| 17 | 
            -
              end
         | 
| 18 | 
            -
            end
         |