Class: RailsGwt::UserConfig
- Inherits:
-
Object
- Object
- RailsGwt::UserConfig
- Defined in:
- lib/rails_gwt/user_config.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#login ⇒ Object
readonly
Returns the value of attribute login.
-
#menu ⇒ Object
readonly
Returns the value of attribute menu.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#resource ⇒ Object
Returns the value of attribute resource.
Instance Method Summary collapse
- #action_buttons ⇒ Object
- #buttons ⇒ Object
- #content ⇒ Object
-
#initialize(login, config) ⇒ UserConfig
constructor
A new instance of UserConfig.
- #mode ⇒ Object
- #resource_id ⇒ Object
- #resources ⇒ Object
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(login, config) @user_config = config raise "unknown login #{login}" unless @user_config @login = login.to_s @name = @user_config[:name] @menu = @user_config[:menu] end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
25 26 27 |
# File 'lib/rails_gwt/user_config.rb', line 25 def action @action end |
#login ⇒ Object (readonly)
Returns the value of attribute login.
25 26 27 |
# File 'lib/rails_gwt/user_config.rb', line 25 def login @login end |
#menu ⇒ Object (readonly)
Returns the value of attribute menu.
25 26 27 |
# File 'lib/rails_gwt/user_config.rb', line 25 def @menu end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
25 26 27 |
# File 'lib/rails_gwt/user_config.rb', line 25 def name @name end |
#resource ⇒ Object
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_buttons ⇒ Object
56 57 58 59 60 |
# File 'lib/rails_gwt/user_config.rb', line 56 def c = @config[@action][:action_buttons] || [] c = [c] unless c.is_a? Array c end |
#buttons ⇒ Object
50 51 52 53 54 |
# File 'lib/rails_gwt/user_config.rb', line 50 def c = @config[@action][:buttons] || [] c = [c] unless c.is_a? Array c end |
#content ⇒ Object
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 |
#mode ⇒ Object
67 68 69 |
# File 'lib/rails_gwt/user_config.rb', line 67 def mode @config[:mode] || :page end |
#resource_id ⇒ Object
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 |
#resources ⇒ Object
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 |