bmg 0.21.3 → 0.21.4
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 +1 -0
- data/lib/bmg/algebra/shortcuts.rb +8 -0
- data/lib/bmg/type.rb +8 -1
- data/lib/bmg/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 59da4b61f1d6c332de148552eab6277032df750c
         | 
| 4 | 
            +
              data.tar.gz: b65877260b6a5eca59fb864f52a08dad26f917f4
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: fd85e6e179eb6e1a4d9ffe2f074db3c0d856d239bc65b8d535d6d14cff987a0af1eed75046aed0538726ff87925b9a2a400153a1acec7d7ecc3cc7fdc50d0e87
         | 
| 7 | 
            +
              data.tar.gz: 5954aad879e293d34eb175ff54055473e3a983e6a16ec816694eb0b16fd90897cbf9d31bcdf53bfdef664891abb42cb538c7962954d76331c291411e816c956b
         | 
    
        data/README.md
    CHANGED
    
    | @@ -245,6 +245,7 @@ r.allbut([:a, :b, ...])                      # remove specified attributes | |
| 245 245 | 
             
            r.autowrap(split: '_')                       # structure a flat relation, split: '_' is the default
         | 
| 246 246 | 
             
            r.autosummarize([:a, :b, ...], x: :sum)      # (experimental) usual summarizers supported
         | 
| 247 247 | 
             
            r.constants(x: 12, ...)                      # add constant attributes (sometimes useful in unions)
         | 
| 248 | 
            +
            r.cross_product(right)                       # cross product, alias `cross_join`
         | 
| 248 249 | 
             
            r.extend(x: ->(t){ ... }, ...)               # add computed attributes
         | 
| 249 250 | 
             
            r.extend(x: :y)                              # shortcut for r.extend(x: ->(t){ t[:y] })
         | 
| 250 251 | 
             
            r.exclude(predicate)                         # shortcut for restrict(!predicate)
         | 
| @@ -57,6 +57,14 @@ module Bmg | |
| 57 57 | 
             
                    self.left_join(right.rename(renaming), on.keys, *args)
         | 
| 58 58 | 
             
                  end
         | 
| 59 59 |  | 
| 60 | 
            +
                  def cross_product(right)
         | 
| 61 | 
            +
                    return join(right) unless self.type.typechecked? || right.type.typechecked?
         | 
| 62 | 
            +
                    return join(right) unless self.type.knows_attrlist? && right.type.knows_attrlist?
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                    self.type.cross_join_compatible!(right)
         | 
| 65 | 
            +
                    return join(right)
         | 
| 66 | 
            +
                  end
         | 
| 67 | 
            +
             | 
| 60 68 | 
             
                  def matching(right, on = [])
         | 
| 61 69 | 
             
                    return super unless on.is_a?(Hash)
         | 
| 62 70 | 
             
                    renaming = Hash[on.map{|k,v| [v,k] }]
         | 
    
        data/lib/bmg/type.rb
    CHANGED
    
    | @@ -310,7 +310,7 @@ module Bmg | |
| 310 310 | 
             
                  }
         | 
| 311 311 | 
             
                end
         | 
| 312 312 |  | 
| 313 | 
            -
               | 
| 313 | 
            +
              public
         | 
| 314 314 |  | 
| 315 315 | 
             
                def known_attributes!(attrs)
         | 
| 316 316 | 
             
                  extra = attrs - self.attrlist
         | 
| @@ -331,5 +331,12 @@ module Bmg | |
| 331 331 | 
             
                  end
         | 
| 332 332 | 
             
                end
         | 
| 333 333 |  | 
| 334 | 
            +
                def cross_join_compatible!(right)
         | 
| 335 | 
            +
                  shared = self.attrlist & right.type.attrlist
         | 
| 336 | 
            +
                  unless shared.empty?
         | 
| 337 | 
            +
                    raise TypeError, "Cross product incompatible — duplicate attribute(s): #{shared.join(', ')}"
         | 
| 338 | 
            +
                  end
         | 
| 339 | 
            +
                end
         | 
| 340 | 
            +
             | 
| 334 341 | 
             
              end # class Type
         | 
| 335 342 | 
             
            end # module Bmg
         | 
    
        data/lib/bmg/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: bmg
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.21. | 
| 4 | 
            +
              version: 0.21.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Bernard Lambeau
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024- | 
| 11 | 
            +
            date: 2024-03-08 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: predicate
         |