Class: Anoubis::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



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'app/controllers/anoubis/etc/base.rb', line 40

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


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

Instance Attribute Details

#actionString

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

Returns:

  • (String)

    current controller action.



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

def action
  @action
end

#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
10
11
# File 'app/controllers/anoubis/etc/base.rb', line 9

def data
  @data
end

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

Returns:

  • (Menu, nil)

    menu information for current controller



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

def menu
  @menu
end

#tabTabItem?

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

Returns:

  • (TabItem, nil)

    tab information for current controller



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

def tab
  @tab
end

#timeNumber

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

Returns:

  • (Number)

    time of request.



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

def time
  @time
end

#versionNumber

Returns API version received from URL. By default sets to 0.

Returns:

  • (Number)

    Specifies the api version.



34
35
36
# File 'app/controllers/anoubis/etc/base.rb', line 34

def version
  @version
end