Class: NativeQuery::Row

Inherits:
Object
  • Object
show all
Defined in:
lib/native-query/row.rb

Overview

Represents one ORM row.

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Row

Constructor.



27
28
29
# File 'lib/native-query/row.rb', line 27

def initialize(data)
    @data = data
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args) ⇒ Object

Maps unknown calls to data fields.



35
36
37
# File 'lib/native-query/row.rb', line 35

def method_missing(sym, *args)
    __data[sym]
end

Instance Method Details

#any?Boolean

Indicates, rows exists.

Returns:

  • (Boolean)


43
44
45
# File 'lib/native-query/row.rb', line 43

def any?
   not __data.nil? 
end

#to_hashObject

Converts to hash.



51
52
53
# File 'lib/native-query/row.rb', line 51

def to_hash
    __data.to_hash
end