Class: Groonga::ViewRecord
- Inherits:
-
Object
- Object
- Groonga::ViewRecord
- Defined in:
- lib/groonga/view-record.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
レコードのID.
-
#view ⇒ Object
readonly
レコードが所属するビュー.
Instance Method Summary collapse
-
#==(other) ⇒ Object
record と other が同じgroongaのレコードなら
true
を返し、 そうでなければfalse
を返す。. -
#[](column_name) ⇒ Object
このレコードの column_name で指定されたカラムの値を返す。.
-
#initialize(view, id) ⇒ ViewRecord
constructor
table の id に対応するレコードを作成する。.
Constructor Details
#initialize(view, id) ⇒ ViewRecord
table の id に対応するレコードを作成する。
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
#id ⇒ Object (readonly)
レコードのID
23 24 25 |
# File 'lib/groonga/view-record.rb', line 23 def id @id end |
#view ⇒ Object (readonly)
レコードが所属するビュー
21 22 23 |
# File 'lib/groonga/view-record.rb', line 21 def view @view end |
Instance Method Details
#==(other) ⇒ Object
record と other が同じ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 |