Class: RailsGwt::UserConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_gwt/user_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(login, config) ⇒ UserConfig

Returns a new instance of UserConfig.



27
28
29
30
31
32
33
# File 'lib/rails_gwt/user_config.rb', line 27

def initialize(, config)
  @user_config = config
  raise "unknown login #{}" unless @user_config
  @login = .to_s
  @name = @user_config[:name]
  @menu = @user_config[:menu]
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



25
26
27
# File 'lib/rails_gwt/user_config.rb', line 25

def action
  @action
end

#loginObject (readonly)

Returns the value of attribute login.



25
26
27
# File 'lib/rails_gwt/user_config.rb', line 25

def 
  @login
end

Returns the value of attribute menu.



25
26
27
# File 'lib/rails_gwt/user_config.rb', line 25

def menu
  @menu
end

#nameObject (readonly)

Returns the value of attribute name.



25
26
27
# File 'lib/rails_gwt/user_config.rb', line 25

def name
  @name
end

#resourceObject

Returns the value of attribute resource.



25
26
27
# File 'lib/rails_gwt/user_config.rb', line 25

def resource
  @resource
end

Instance Method Details

#action_buttonsObject



56
57
58
59
60
# File 'lib/rails_gwt/user_config.rb', line 56

def action_buttons
  c = @config[@action][:action_buttons] || []
  c = [c] unless c.is_a? Array
  c
end

#buttonsObject



50
51
52
53
54
# File 'lib/rails_gwt/user_config.rb', line 50

def buttons
  c = @config[@action][:buttons] || []
  c = [c] unless c.is_a? Array
  c
end

#contentObject



44
45
46
47
48
# File 'lib/rails_gwt/user_config.rb', line 44

def content
  c = @config[@action][:content] || []
  c = [c] unless c.is_a? Array
  c
end

#modeObject



67
68
69
# File 'lib/rails_gwt/user_config.rb', line 67

def mode
  @config[:mode] || :page
end

#resource_idObject



71
72
73
74
75
76
77
# File 'lib/rails_gwt/user_config.rb', line 71

def resource_id
  if id = @config[:resource_id]
    self.class_eval(id)
  else
    1
  end
end

#resourcesObject



35
36
37
# File 'lib/rails_gwt/user_config.rb', line 35

def resources
  @user_config.collect { |k,v| k.to_s if v.is_a? Hash }.delete_if { |i| i.nil? }.sort!.collect { |i| i.to_sym }
end