Class: Anubis::Etc::Base

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/anoubis/etc/base.rb

Overview

Basic system variables class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Sets default system parameters

Parameters:

  • options (Hash) (defaults to: {})

    initial class options

Options Hash (options):

  • :params (ActionController::Parameters)

    initial controller parameters



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'app/controllers/anoubis/etc/base.rb', line 35

def initialize(options = {})
  self.data = nil
  self.menu = nil
  self.tab = nil
  self.action = ''

  if options.key? :params
    self.action = options[:params][:action] if options[:params].key? :action
    if options[:params].key? :time
      self.time = options[:params][:time].to_s.to_i
    else
      self.time = 0
    end
  end
end

Instance Attribute Details

#actionString

Returns current controller action. By default sets to controller action or ''.

Returns:

  • (String)

    current controller action.



24
# File 'app/controllers/anoubis/etc/base.rb', line 24

class_attribute :action, default: ''

#dataData?

Note:

In this attribute placed data when loaded from the model by actions 'table', 'edit', 'update', 'create' etc.

Returns current loaded data or nil if data not loaded.

Returns:

  • (Data, nil)

    current loaded data or nil if data not loaded.



9
# File 'app/controllers/anoubis/etc/base.rb', line 9

class_attribute :data

Returns menu information for current controller. By default sets to nil.

Returns:

  • (Menu, nil)

    menu information for current controller



14
# File 'app/controllers/anoubis/etc/base.rb', line 14

class_attribute :menu, default: nil

#tabTabItem?

Returns tab information for current controller. By default sets to nil.

Returns:

  • (TabItem, nil)

    tab information for current controller



19
# File 'app/controllers/anoubis/etc/base.rb', line 19

class_attribute :tab, default: nil

#timeNumber

Returns time that was requested from client. By default sets to 0.

Returns:

  • (Number)

    time of request.



29
# File 'app/controllers/anoubis/etc/base.rb', line 29

class_attribute :time, default: 0