activecube 0.1.17 → 0.1.18
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/Gemfile.lock +1 -1
- data/lib/activecube.rb +1 -0
- data/lib/activecube/query/cube_query.rb +3 -1
- data/lib/activecube/query_methods.rb +5 -2
- data/lib/activecube/version.rb +1 -1
- data/lib/activecube/view.rb +32 -0
- data/lib/activecube/view_definition.rb +16 -0
- metadata +4 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 774718534987fd65114b6d33ef5ea98f28ffc146bc1cb9e3299d4ec6b571f2cc
         | 
| 4 | 
            +
              data.tar.gz: 317c3d6e4472c20724ccf6d31202842623ddb05725b002baf8d0224d4bb42af4
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: bef4f7a62f25b52eb6ef8b07d89248b7a579c6f329bb3e645e7d59dd96d336fa7534e6669c6bb598d70392220e00d854a9481d956b6eeac8ad020cd728473dc9
         | 
| 7 | 
            +
              data.tar.gz: b7152cde69fc96042edbe3be784c5d857def4984d07776da95c5af2d24bab45d0a9cf9afc716eb317b27e5eed204a76478cf32d37d9aaeac2456edd4ced05eb4
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/lib/activecube.rb
    CHANGED
    
    
| @@ -20,7 +20,9 @@ module Activecube::Query | |
| 20 20 | 
             
                  @measures = measures
         | 
| 21 21 | 
             
                  @selectors = selectors
         | 
| 22 22 | 
             
                  @options = options
         | 
| 23 | 
            -
                  @tables = model_tables || cube.models.map{|m| | 
| 23 | 
            +
                  @tables = model_tables || cube.models.map{|m|
         | 
| 24 | 
            +
                    m < Activecube::View ? m.new : Activecube::Processor::Table.new(m)
         | 
| 25 | 
            +
                  }
         | 
| 24 26 | 
             
                end
         | 
| 25 27 |  | 
| 26 28 | 
             
                def slice *args
         | 
| @@ -24,9 +24,12 @@ module Activecube | |
| 24 24 |  | 
| 25 25 |  | 
| 26 26 | 
             
                def super_model
         | 
| 27 | 
            -
                  raise Activecube::InputArgumentError, "No tables specified for cube #{name}"  | 
| 27 | 
            +
                  raise Activecube::InputArgumentError, "No tables specified for cube #{name}" unless models && models.count>0
         | 
| 28 28 |  | 
| 29 | 
            -
             | 
| 29 | 
            +
             | 
| 30 | 
            +
                  models.collect{|m|
         | 
| 31 | 
            +
                    m < View ? m.models : m
         | 
| 32 | 
            +
                  }.flatten.uniq.collect{ |t|
         | 
| 30 33 | 
             
                    t.ancestors.select{|c| c < ActiveRecord::Base }
         | 
| 31 34 | 
             
                  }.transpose.select{|c|
         | 
| 32 35 | 
             
                    c.uniq.count==1
         | 
    
        data/lib/activecube/version.rb
    CHANGED
    
    
| @@ -0,0 +1,32 @@ | |
| 1 | 
            +
            require 'activecube/view_definition'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Activecube
         | 
| 4 | 
            +
              class View
         | 
| 5 | 
            +
                extend ViewDefinition
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def model
         | 
| 8 | 
            +
                  self.class
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def name
         | 
| 12 | 
            +
                  model.name
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                def matches? query, _measures = query.measures
         | 
| 16 | 
            +
                  true
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                def measures? measure
         | 
| 20 | 
            +
                  true
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                def query _cube_query
         | 
| 24 | 
            +
                  raise "query method have to be implemented in #{name}"
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                def join _cube_query, _left_query, _right_query
         | 
| 28 | 
            +
                  raise "join method have to be implemented in #{name}"
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
              end
         | 
| 32 | 
            +
            end
         | 
| @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            require 'active_support/concern'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Activecube::ViewDefinition
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                attr_reader :activecube_indexes, :models
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                def index index_name, *args
         | 
| 8 | 
            +
                  (@activecube_indexes ||= []) << Activecube::Processor::Index.new(index_name,*args)
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def table x
         | 
| 12 | 
            +
                  (@models ||= []) << x
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
             | 
| 16 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: activecube
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.18
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Aleksey Studnev
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2020-05- | 
| 11 | 
            +
            date: 2020-05-21 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activerecord
         | 
| @@ -117,6 +117,8 @@ files: | |
| 117 117 | 
             
            - lib/activecube/query_methods.rb
         | 
| 118 118 | 
             
            - lib/activecube/selector.rb
         | 
| 119 119 | 
             
            - lib/activecube/version.rb
         | 
| 120 | 
            +
            - lib/activecube/view.rb
         | 
| 121 | 
            +
            - lib/activecube/view_definition.rb
         | 
| 120 122 | 
             
            homepage: https://github.com/bitquery/activecube
         | 
| 121 123 | 
             
            licenses:
         | 
| 122 124 | 
             
            - MIT
         |