cell_set 0.1.2 → 0.1.3
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.
- data/lib/cell_set/cell.rb +1 -1
- data/lib/cell_set/cell_set.rb +12 -12
- data/lib/cell_set/cell_set_axis.rb +5 -5
- data/lib/cell_set/member.rb +9 -9
- data/lib/cell_set/position.rb +3 -3
- data/lib/cell_set/version.rb +1 -1
- metadata +2 -2
    
        data/lib/cell_set/cell.rb
    CHANGED
    
    
    
        data/lib/cell_set/cell_set.rb
    CHANGED
    
    | @@ -35,11 +35,11 @@ module CellSet | |
| 35 35 | 
             
                        axis['cell_set'] = self
         | 
| 36 36 | 
             
                        CellSetAxis.new(axis)
         | 
| 37 37 | 
             
                      else
         | 
| 38 | 
            -
                         | 
| 38 | 
            +
                        raise ArgumentError
         | 
| 39 39 | 
             
                      end
         | 
| 40 40 | 
             
                    end
         | 
| 41 41 | 
             
                  else
         | 
| 42 | 
            -
                     | 
| 42 | 
            +
                    raise ArgumentError
         | 
| 43 43 | 
             
                  end
         | 
| 44 44 | 
             
                end
         | 
| 45 45 |  | 
| @@ -49,18 +49,18 @@ module CellSet | |
| 49 49 |  | 
| 50 50 | 
             
                def cell(*args)
         | 
| 51 51 | 
             
                  if args[0].is_a?(NilClass)
         | 
| 52 | 
            -
                     | 
| 52 | 
            +
                    raise ArgumentError
         | 
| 53 53 | 
             
                  elsif args[0].is_a?(Fixnum) && args.length == 1
         | 
| 54 54 | 
             
                    getCellInternal(args[0])
         | 
| 55 55 | 
             
                  elsif args[0].is_a?(Array) && args.length == 1
         | 
| 56 56 | 
             
                    getCellInternal(coordinatesToOrdinal(args[0]))
         | 
| 57 57 | 
             
                  elsif args.select{|arg| arg.is_a?(Position)}.length == args.length
         | 
| 58 58 | 
             
                    unless args.length == axes.length
         | 
| 59 | 
            -
                       | 
| 59 | 
            +
                      raise ArgumentError, "cell coordinates should have dimension #{axis.length}"
         | 
| 60 60 | 
             
                    end
         | 
| 61 61 | 
             
                    cell(args.map{|position| position.getOrdinal})
         | 
| 62 62 | 
             
                  else
         | 
| 63 | 
            -
                     | 
| 63 | 
            +
                    raise ArgumentError
         | 
| 64 64 | 
             
                  end
         | 
| 65 65 | 
             
                end
         | 
| 66 66 |  | 
| @@ -73,19 +73,19 @@ module CellSet | |
| 73 73 | 
             
                          "value" => cell.value
         | 
| 74 74 | 
             
                        }
         | 
| 75 75 | 
             
                      else
         | 
| 76 | 
            -
                         | 
| 76 | 
            +
                        raise ArgumentError
         | 
| 77 77 | 
             
                      end
         | 
| 78 78 | 
             
                    end
         | 
| 79 79 | 
             
                  elsif cells.is_a?(Hash)
         | 
| 80 80 | 
             
                    @cellHash = cells
         | 
| 81 81 | 
             
                  else
         | 
| 82 | 
            -
                     | 
| 82 | 
            +
                    raise ArgumentError
         | 
| 83 83 | 
             
                  end
         | 
| 84 84 | 
             
                end
         | 
| 85 85 |  | 
| 86 86 | 
             
                def coordinatesToOrdinal(coordinates)
         | 
| 87 87 | 
             
                  unless coordinates.length == @axes.length
         | 
| 88 | 
            -
                     | 
| 88 | 
            +
                    raise ArgumentError, "Coordinates have different dimension #{coordinates.length} than axes #{@axes.length}"
         | 
| 89 89 | 
             
                  end
         | 
| 90 90 |  | 
| 91 91 | 
             
                  modulo = 1
         | 
| @@ -95,7 +95,7 @@ module CellSet | |
| 95 95 | 
             
                    coordinate = coordinates[k]
         | 
| 96 96 | 
             
                    k += 1
         | 
| 97 97 | 
             
                    if coordinate < 0 || coordinate >= axis.positionCount
         | 
| 98 | 
            -
                       | 
| 98 | 
            +
                      raise IndexError, "Coordinate #{coordinate} of axis #{k} is out of range (#{bounds.join(", ")})"
         | 
| 99 99 | 
             
                    end
         | 
| 100 100 | 
             
                    ordinal += coordinate * modulo
         | 
| 101 101 | 
             
                    modulo *= axis.positionCount
         | 
| @@ -108,7 +108,7 @@ module CellSet | |
| 108 108 | 
             
                end
         | 
| 109 109 |  | 
| 110 110 | 
             
                def getFilterAxis
         | 
| 111 | 
            -
                   | 
| 111 | 
            +
                  raise NotImplementedError
         | 
| 112 112 | 
             
                end
         | 
| 113 113 |  | 
| 114 114 | 
             
                def initialize(*)
         | 
| @@ -134,7 +134,7 @@ module CellSet | |
| 134 134 | 
             
                  end
         | 
| 135 135 |  | 
| 136 136 | 
             
                  if ordinal < 0 || ordinal >= modulo
         | 
| 137 | 
            -
                     | 
| 137 | 
            +
                    raise IndexError, "Cell ordinal #{ordinal} lies outside CellSet bounds (#{bounds.join(", ")})"
         | 
| 138 138 | 
             
                  end
         | 
| 139 139 |  | 
| 140 140 | 
             
                  list
         | 
| @@ -147,7 +147,7 @@ module CellSet | |
| 147 147 | 
             
                  cell = @cellHash[pos.to_s]
         | 
| 148 148 | 
             
                  if cell.nil?
         | 
| 149 149 | 
             
                    if (pos < 0 || pos >= maxOrdinal)
         | 
| 150 | 
            -
                       | 
| 150 | 
            +
                      raise IndexError
         | 
| 151 151 | 
             
                    else
         | 
| 152 152 | 
             
                      Cell.new(:formatted_value => "", :ordinal => pos)
         | 
| 153 153 | 
             
                    end
         | 
| @@ -14,7 +14,7 @@ module CellSet | |
| 14 14 | 
             
                  if other.is_a?(self.class)
         | 
| 15 15 | 
             
                    @axis_ordinal <=> other.axis_ordinal
         | 
| 16 16 | 
             
                  else
         | 
| 17 | 
            -
                    raise | 
| 17 | 
            +
                    raise ArgumentError, "Must compare #{self.class.to_s} to another #{self.class.to_s}"
         | 
| 18 18 | 
             
                  end
         | 
| 19 19 | 
             
                end
         | 
| 20 20 |  | 
| @@ -24,7 +24,7 @@ module CellSet | |
| 24 24 | 
             
                  elsif ordinal.is_a?(String)
         | 
| 25 25 | 
             
                    Integer(ordinal)
         | 
| 26 26 | 
             
                  else
         | 
| 27 | 
            -
                     | 
| 27 | 
            +
                    raise ArgumentError
         | 
| 28 28 | 
             
                  end
         | 
| 29 29 | 
             
                end
         | 
| 30 30 |  | 
| @@ -38,7 +38,7 @@ module CellSet | |
| 38 38 | 
             
                  elsif cell_set.is_a?(Hash)
         | 
| 39 39 | 
             
                    CellSet.new(cell_set)
         | 
| 40 40 | 
             
                  else
         | 
| 41 | 
            -
                     | 
| 41 | 
            +
                    raise ArgumentError
         | 
| 42 42 | 
             
                  end
         | 
| 43 43 | 
             
                end
         | 
| 44 44 |  | 
| @@ -58,11 +58,11 @@ module CellSet | |
| 58 58 | 
             
                      elsif position.is_a?(Hash)
         | 
| 59 59 | 
             
                        Position.new(position)
         | 
| 60 60 | 
             
                      else
         | 
| 61 | 
            -
                         | 
| 61 | 
            +
                        raise ArgumentError
         | 
| 62 62 | 
             
                      end
         | 
| 63 63 | 
             
                    end
         | 
| 64 64 | 
             
                  else
         | 
| 65 | 
            -
                     | 
| 65 | 
            +
                    raise ArgumentError
         | 
| 66 66 | 
             
                  end
         | 
| 67 67 | 
             
                end
         | 
| 68 68 |  | 
    
        data/lib/cell_set/member.rb
    CHANGED
    
    | @@ -18,7 +18,7 @@ module CellSet | |
| 18 18 | 
             
                end
         | 
| 19 19 |  | 
| 20 20 | 
             
                def ancestorMembers
         | 
| 21 | 
            -
                   | 
| 21 | 
            +
                  raise NotImplementedError
         | 
| 22 22 | 
             
                end
         | 
| 23 23 |  | 
| 24 24 | 
             
                def between?(min, max)
         | 
| @@ -26,23 +26,23 @@ module CellSet | |
| 26 26 | 
             
                end
         | 
| 27 27 |  | 
| 28 28 | 
             
                def childMemberCount
         | 
| 29 | 
            -
                   | 
| 29 | 
            +
                  raise NotImplementedError
         | 
| 30 30 | 
             
                end
         | 
| 31 31 |  | 
| 32 32 | 
             
                def all?
         | 
| 33 | 
            -
                   | 
| 33 | 
            +
                  raise NotImplementedError
         | 
| 34 34 | 
             
                end
         | 
| 35 35 |  | 
| 36 36 | 
             
                def calculated?
         | 
| 37 | 
            -
                   | 
| 37 | 
            +
                  raise NotImplementedError
         | 
| 38 38 | 
             
                end
         | 
| 39 39 |  | 
| 40 40 | 
             
                def calculatedInQuery?
         | 
| 41 | 
            -
                   | 
| 41 | 
            +
                  raise NotImplementedError
         | 
| 42 42 | 
             
                end
         | 
| 43 43 |  | 
| 44 44 | 
             
                def childOrEqualTo?(member)
         | 
| 45 | 
            -
                   | 
| 45 | 
            +
                  raise NotImplementedError
         | 
| 46 46 | 
             
                end
         | 
| 47 47 |  | 
| 48 48 | 
             
                def from_json(*)
         | 
| @@ -50,7 +50,7 @@ module CellSet | |
| 50 50 | 
             
                end
         | 
| 51 51 |  | 
| 52 52 | 
             
                def hidden?
         | 
| 53 | 
            -
                   | 
| 53 | 
            +
                  raise NotImplementedError
         | 
| 54 54 | 
             
                end
         | 
| 55 55 |  | 
| 56 56 | 
             
                def initialize(*)
         | 
| @@ -64,12 +64,12 @@ module CellSet | |
| 64 64 | 
             
                  elsif ordinal.is_a?(String)
         | 
| 65 65 | 
             
                    Integer(ordinal)
         | 
| 66 66 | 
             
                  else
         | 
| 67 | 
            -
                     | 
| 67 | 
            +
                    raise ArgumentError
         | 
| 68 68 | 
             
                  end
         | 
| 69 69 | 
             
              end
         | 
| 70 70 |  | 
| 71 71 | 
             
                def visible?
         | 
| 72 | 
            -
                   | 
| 72 | 
            +
                  raise NotImplementedError
         | 
| 73 73 | 
             
                end
         | 
| 74 74 | 
             
              end
         | 
| 75 75 | 
             
            end
         | 
    
        data/lib/cell_set/position.rb
    CHANGED
    
    | @@ -39,11 +39,11 @@ module CellSet | |
| 39 39 | 
             
                      elsif member.is_a?(Hash)
         | 
| 40 40 | 
             
                        Member.new(member)
         | 
| 41 41 | 
             
                      else
         | 
| 42 | 
            -
                         | 
| 42 | 
            +
                        raise ArgumentError
         | 
| 43 43 | 
             
                      end
         | 
| 44 44 | 
             
                    end
         | 
| 45 45 | 
             
                  else
         | 
| 46 | 
            -
                     | 
| 46 | 
            +
                    raise ArgumentError
         | 
| 47 47 | 
             
                  end
         | 
| 48 48 | 
             
                end
         | 
| 49 49 |  | 
| @@ -53,7 +53,7 @@ module CellSet | |
| 53 53 | 
             
                  elsif ordinal.is_a?(String)
         | 
| 54 54 | 
             
                    Integer(ordinal)
         | 
| 55 55 | 
             
                  else
         | 
| 56 | 
            -
                     | 
| 56 | 
            +
                    raise ArgumentError
         | 
| 57 57 | 
             
                  end
         | 
| 58 58 | 
             
                end
         | 
| 59 59 | 
             
              end
         | 
    
        data/lib/cell_set/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: cell_set
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.3
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2012-03- | 
| 12 | 
            +
            date: 2012-03-27 00:00:00.000000000Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: activesupport
         |