Class: Groonga::ViewRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga/view-record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view, id) ⇒ ViewRecord

tableid に対応するレコードを作成する。



26
27
28
29
# File 'lib/groonga/view-record.rb', line 26

def initialize(view, id)
  @view = view
  @id = id
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object (private)



44
45
46
47
48
# File 'lib/groonga/view-record.rb', line 44

def method_missing(name, *args, &block)
  return super if /(?:=|\?)\z/ =~ name.to_s
  return super unless args.empty?
  self[name.to_s]
end

Instance Attribute Details

#idObject (readonly)

レコードのID



23
24
25
# File 'lib/groonga/view-record.rb', line 23

def id
  @id
end

#viewObject (readonly)

レコードが所属するビュー



21
22
23
# File 'lib/groonga/view-record.rb', line 21

def view
  @view
end

Instance Method Details

#==(other) ⇒ Object

recordother が同じgroongaのレコードなら true を返し、 そうでなければ false を返す。



33
34
35
36
# File 'lib/groonga/view-record.rb', line 33

def ==(other)
  self.class == other.class and
    [view, id] == [other.view, other.id]
end

#[](column_name) ⇒ Object

このレコードの column_name で指定されたカラムの値を返す。



39
40
41
# File 'lib/groonga/view-record.rb', line 39

def [](column_name)
  @view.column_value(@id, column_name)
end