Wraps an immutable column map and adds indexes for columns it doesn’t have, such as aliases selected alongside a model’s columns. The query that selected those columns can also say what type each one is.
Methods
- #
-
- A
-
- E
-
- F
-
- H
-
- K
-
- N
-
- S
-
- T
-
Attributes
|
[R]
|
extra |
|
|
[R]
|
extra_types |
|
|
[R]
|
indexes |
|
Class Public methods
add(indexes, column, index)
Link
Source:
show
|
on GitHub
def self.add(indexes, column, index)
if indexes.is_a?(self)
new(indexes.indexes, indexes.extra.merge(column => index).freeze, indexes.extra_types)
else
new(indexes, { column => index }.freeze)
end
end
new(indexes, extra, extra_types = EMPTY_TYPES)
Link
extra_types has the types of the extra columns that have one, by slot. : (Hash[String, Integer], Hash[String, Integer], ?Hash[Integer, Type::Value]) -> void
Source:
show
|
on GitHub
def initialize(indexes, extra, extra_types = EMPTY_TYPES)
@indexes = indexes
@extra = extra
@extra_types = extra_types
freeze
end
Instance Public methods
==(other)
Link
Source:
show
|
on GitHub
def ==(other)
other.is_a?(ExtendedIndexes) && @indexes == other.indexes && @extra == other.extra &&
@extra_types == other.extra_types
end
[](column)
Link
Source:
show
|
on GitHub
def [](column)
@indexes[column] || @extra[column]
end
each_key(&block)
Link
: () ?{ (String) -> void } -> (self | Enumerator[String, self])
Source:
show
|
on GitHub
def each_key(&block)
return enum_for(:each_key) { size } unless block
@indexes.each_key(&block)
@extra.each_key(&block)
self
end
each_value(&block)
Link
: () ?{ (Integer) -> void } -> (self | Enumerator[Integer, self])
Source:
show
|
on GitHub
def each_value(&block)
return enum_for(:each_value) { size } unless block
@indexes.each_value(&block)
@extra.each_value(&block)
self
end
fetch(column, &block)
Link
Source:
show
|
on GitHub
def fetch(column, &block)
@indexes.fetch(column) { @extra.fetch(column, &block) }
end
Source:
show
|
on GitHub
def hash
[ExtendedIndexes, @indexes, @extra, @extra_types].hash
end
key?(column)
Link
Source:
show
|
on GitHub
def key?(column)
@indexes.key?(column) || @extra.key?(column)
end
Source:
show
|
on GitHub
def keys
@indexes.keys + @extra.keys
end
Source:
show
|
on GitHub
def size
@indexes.size + @extra.size
end
type_at(slot)
Link
The type of the extra column at slot, if it has one. : (Integer) -> Type::Value?
Source:
show
|
on GitHub
def type_at(slot)
@extra_types[slot]
end