xml-mixup 0.1.10 → 0.1.11
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/xml/mixup/version.rb +1 -1
 - data/lib/xml/mixup.rb +13 -12
 - data/xml-mixup.gemspec +1 -11
 - metadata +5 -6
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 52f06d4fa85d31f07ed928b7d1c0106e62f10931f1292464314a95bb9a77e276
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 54a0f85692dc6e558009550094aeccecbbdfda6c286977eaccd312c6042e438c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 737ca243a7a520a59968bc8613e31dda5a7f7e859bf06fcdfe9352f268a417dc95fee7e8b7e458cca9337b1d19f79795a97c28da133929e4f0ef236c5bc38352
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 5767a7fd2688e3242ea9f42030b8cb926eed8e7b1c90c5b8478487ee9b1143931f23493eeb79c53101a3fad40e4987591d2d496f31d0651415d880004806dd49
         
     | 
    
        data/lib/xml/mixup/version.rb
    CHANGED
    
    
    
        data/lib/xml/mixup.rb
    CHANGED
    
    | 
         @@ -174,35 +174,36 @@ module XML::Mixup 
     | 
|
| 
       174 
174 
     | 
    
         
             
                      else 
         
     | 
| 
       175 
175 
     | 
    
         
             
                        name = x
         
     | 
| 
       176 
176 
     | 
    
         
             
                      end
         
     | 
| 
       177 
     | 
    
         
            -
                    elsif (compact = spec.select { |k, _|
         
     | 
| 
       178 
     | 
    
         
            -
             
     | 
| 
       179 
     | 
    
         
            -
                        not compact.empty?
         
     | 
| 
      
 177 
     | 
    
         
            +
                    elsif (compact = spec.select { |k, _| k.respond_to?(:to_a) or
         
     | 
| 
      
 178 
     | 
    
         
            +
                               k.is_a?(Nokogiri::XML::Node)}) and !compact.empty?
         
     | 
| 
       180 
179 
     | 
    
         
             
                      # compact syntax eliminates the `nil` key
         
     | 
| 
       181 
180 
     | 
    
         
             
                      raise %q{Spec can't have duplicate compact keys} if compact.count > 1
         
     | 
| 
       182 
181 
     | 
    
         
             
                      children, name = compact.first
         
     | 
| 
       183 
     | 
    
         
            -
                      children = children. 
     | 
| 
       184 
     | 
    
         
            -
             
     | 
| 
       185 
     | 
    
         
            -
             
     | 
| 
       186 
     | 
    
         
            -
             
     | 
| 
      
 182 
     | 
    
         
            +
                      children = children.is_a?(Hash) ||
         
     | 
| 
      
 183 
     | 
    
         
            +
                        children.is_a?(Nokogiri::XML::Node) ? [children] : children.to_a 
         
     | 
| 
      
 184 
     | 
    
         
            +
                    elsif (special = spec.select { |k, _| k.respond_to? :to_s and
         
     | 
| 
      
 185 
     | 
    
         
            +
                               k.to_s.start_with? ?# }) and !special.empty?
         
     | 
| 
       187 
186 
     | 
    
         
             
                      # these are special keys 
         
     | 
| 
       188 
187 
     | 
    
         
             
                      raise %q{Spec can't have multiple special keys} if special.count > 1
         
     | 
| 
       189 
188 
     | 
    
         
             
                      name, children = special.first
         
     | 
| 
       190 
189 
     | 
    
         | 
| 
       191 
     | 
    
         
            -
                      if %w{# #elem #element #tag}. 
     | 
| 
      
 190 
     | 
    
         
            +
                      if %w{# #elem #element #tag}.include? name
         
     | 
| 
       192 
191 
     | 
    
         
             
                        # then the name is in the `children` slot
         
     | 
| 
       193 
192 
     | 
    
         
             
                        raise "Value of #{name} shorthand formulation" +
         
     | 
| 
       194 
     | 
    
         
            -
                          "must be a valid element name" unless children.to_s
         
     | 
| 
      
 193 
     | 
    
         
            +
                          "must be a valid element name" unless children.respond_to? :to_s
         
     | 
| 
       195 
194 
     | 
    
         
             
                        name = children
         
     | 
| 
       196 
195 
     | 
    
         
             
                        # set children to empty array
         
     | 
| 
       197 
196 
     | 
    
         
             
                        children = []
         
     | 
| 
       198 
197 
     | 
    
         
             
                      elsif not RESERVED.any? name
         
     | 
| 
       199 
198 
     | 
    
         
             
                        # then the name is encoded into the key and we have to
         
     | 
| 
       200 
199 
     | 
    
         
             
                        # remove the octothorpe
         
     | 
| 
       201 
     | 
    
         
            -
                        name = name 
     | 
| 
      
 200 
     | 
    
         
            +
                        name = name.delete_prefix ?#
         
     | 
| 
      
 201 
     | 
    
         
            +
                        # note we assign because the object is input and may be frozen
         
     | 
| 
       202 
202 
     | 
    
         
             
                      end
         
     | 
| 
       203 
203 
     | 
    
         | 
| 
       204 
204 
     | 
    
         
             
                      # don't forget to reset the child nodes
         
     | 
| 
       205 
     | 
    
         
            -
                      children = children. 
     | 
| 
      
 205 
     | 
    
         
            +
                      children = children.is_a?(Hash) || !children.respond_to?(:to_a) ?
         
     | 
| 
      
 206 
     | 
    
         
            +
                        [children] : children.to_a 
         
     | 
| 
       206 
207 
     | 
    
         
             
                    end
         
     | 
| 
       207 
208 
     | 
    
         | 
| 
       208 
209 
     | 
    
         
             
                    # note the name can be nil because it can be inferred
         
     | 
| 
         @@ -245,7 +246,7 @@ module XML::Mixup 
     | 
|
| 
       245 
246 
     | 
    
         
             
                      # attach it
         
     | 
| 
       246 
247 
     | 
    
         
             
                      ADJACENT[adj].call node, nodes[adj]
         
     | 
| 
       247 
248 
     | 
    
         | 
| 
       248 
     | 
    
         
            -
                    elsif  
     | 
| 
      
 249 
     | 
    
         
            +
                    elsif %w[#dtd #doctype].include? name
         
     | 
| 
       249 
250 
     | 
    
         
             
                      # now doctype declarations
         
     | 
| 
       250 
251 
     | 
    
         
             
                      if children.empty?
         
     | 
| 
       251 
252 
     | 
    
         
             
                        raise "DTD node must have a root element declaration"
         
     | 
    
        data/xml-mixup.gemspec
    CHANGED
    
    | 
         @@ -14,16 +14,6 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       14 
14 
     | 
    
         
             
              spec.homepage      = "https://github.com/doriantaylor/rb-xml-mixup"
         
     | 
| 
       15 
15 
     | 
    
         
             
              spec.required_ruby_version = "~> 2.0"
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
              # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
         
     | 
| 
       18 
     | 
    
         
            -
              # to allow pushing to a single host or delete this section to allow pushing to any host.
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
              # if spec.respond_to?(:metadata)
         
     | 
| 
       21 
     | 
    
         
            -
              #   spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
         
     | 
| 
       22 
     | 
    
         
            -
              # else
         
     | 
| 
       23 
     | 
    
         
            -
              #   raise "RubyGems 2.0 or newer is required to protect against " \
         
     | 
| 
       24 
     | 
    
         
            -
              #     "public gem pushes."
         
     | 
| 
       25 
     | 
    
         
            -
              # end
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
       27 
17 
     | 
    
         
             
              spec.files         = `git ls-files -z`.split("\x0").reject do |f|
         
     | 
| 
       28 
18 
     | 
    
         
             
                f.match(%r{^(test|spec|features)/})
         
     | 
| 
       29 
19 
     | 
    
         
             
              end
         
     | 
| 
         @@ -35,5 +25,5 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       35 
25 
     | 
    
         
             
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
| 
       36 
26 
     | 
    
         
             
              spec.add_development_dependency "rspec", "~> 3.0"
         
     | 
| 
       37 
27 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
              spec.add_dependency "nokogiri", "~> 1. 
     | 
| 
      
 28 
     | 
    
         
            +
              spec.add_dependency "nokogiri", "~> 1.10.4"
         
     | 
| 
       39 
29 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: xml-mixup
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.11
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Dorian Taylor
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2019- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2019-08-20 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -58,14 +58,14 @@ dependencies: 
     | 
|
| 
       58 
58 
     | 
    
         
             
                requirements:
         
     | 
| 
       59 
59 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       60 
60 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
     | 
    
         
            -
                    version:  
     | 
| 
      
 61 
     | 
    
         
            +
                    version: 1.10.4
         
     | 
| 
       62 
62 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       63 
63 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       64 
64 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
65 
     | 
    
         
             
                requirements:
         
     | 
| 
       66 
66 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       67 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       68 
     | 
    
         
            -
                    version:  
     | 
| 
      
 68 
     | 
    
         
            +
                    version: 1.10.4
         
     | 
| 
       69 
69 
     | 
    
         
             
            description: XML::Mixup uses declarative data structures to incrementally generate
         
     | 
| 
       70 
70 
     | 
    
         
             
              XML.
         
     | 
| 
       71 
71 
     | 
    
         
             
            email:
         
     | 
| 
         @@ -104,8 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       104 
104 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       105 
105 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       106 
106 
     | 
    
         
             
            requirements: []
         
     | 
| 
       107 
     | 
    
         
            -
             
     | 
| 
       108 
     | 
    
         
            -
            rubygems_version: 2.7.6
         
     | 
| 
      
 107 
     | 
    
         
            +
            rubygems_version: 3.0.3
         
     | 
| 
       109 
108 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       110 
109 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       111 
110 
     | 
    
         
             
            summary: A mixin for (XML) markup
         
     |