跳至内容 跳至搜索
方法
#
E
F
K
L
N
S
T

类 公共方法

new(column_indexes, row)

# File activerecord/lib/active_record/result.rb, line 40
def initialize(column_indexes, row)
  @column_indexes = column_indexes
  @row = row
end

实例 公共方法

==(other)

# File activerecord/lib/active_record/result.rb, line 58
def ==(other)
  if other.is_a?(Hash)
    to_hash == other
  else
    super
  end
end

[](column)

# File activerecord/lib/active_record/result.rb, line 80
def [](column)
  if index = @column_indexes[column]
    @row[index]
  end
end

each_key(&block)

# File activerecord/lib/active_record/result.rb, line 50
def each_key(&block)
  @column_indexes.each_key(&block)
end

fetch(column)

# File activerecord/lib/active_record/result.rb, line 70
def fetch(column)
  if index = @column_indexes[column]
    @row[index]
  elsif block_given?
    yield
  else
    raise KeyError, "key not found: #{column.inspect}"
  end
end

key?(column)

# File activerecord/lib/active_record/result.rb, line 66
def key?(column)
  @column_indexes.key?(column)
end

keys()

# File activerecord/lib/active_record/result.rb, line 54
def keys
  @column_indexes.keys
end

length()

别名: size

size()

也别名为: length
# File activerecord/lib/active_record/result.rb, line 45
def size
  @column_indexes.size
end

to_h()

也别名为: to_hash
# File activerecord/lib/active_record/result.rb, line 86
def to_h
  @column_indexes.transform_values { |index| @row[index] }
end

to_hash()

别名: to_h