Module: Tiun::Model

Defined in:
lib/tiun/model.rb

Constant Summary collapse

Auth =
Tiun::Model::Auth
Token =
Tiun::Model::Token
Account =
Tiun::Model::Account

Instance Method Summary collapse

Instance Method Details

#range(range) ⇒ Object

Specify range to return



59
60
61
# File 'lib/tiun/model.rb', line 59

def range range
   offset(range.begin).limit(range.end - range.begin + 1)
end

#tiunObject

tiun sets up tiuner for the model. This exports corresponding record fields to default dashboard method, which loads the react component. When the model has been set up, the method returns the compiled data of the model.

Examples:

tiun

Model.tiun


14
15
16
17
18
19
20
21
22
23
24
# File 'lib/tiun/model.rb', line 14

def tiun
   ## return self.instance_variable_get(:@tiun) if self.instance_variables.include?(:@tiun)

   ## self.instance_variable_set(:@tiun, { fields: _tiun_parse_model})

   ## tiuns = self.class.instance_variables.include?(:@tiun) && self.class.instance_variable_get(:@tiuns) || []
   ## tiuns << self
   ## self.class.instance_variable_set(:@tiuns, tiuns)
   #
   # belongs_to, has_many, has_one
end

#tiunsObject

tiuns returns lists of the tiuned models. In case the list is absent returns blank Array.

Examples:

Model.tiuns # => [ Model ]

ActiveRecord::Base.tiuns # => []


35
36
37
# File 'lib/tiun/model.rb', line 35

def tiuns
   self.class.instance_variable_get(:@tiuns) || []
end