Class: RailsJqGrid::JqGridOptionOrMethod
- Inherits:
-
Object
- Object
- RailsJqGrid::JqGridOptionOrMethod
- Includes:
- ActiveSupport::Inflector
- Defined in:
- app/models/rails_jq_grid/jq_grid_option_or_method.rb
Overview
Contains all information for one option or method
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#<<(*args) ⇒ Object
works like JqGridMethodMissing.raw.
-
#escaped_name ⇒ Object
option name ist camalized with a lower start character transforms from ruby style to jqgrid style before_submit => beforeSubmit.
-
#escaped_value ⇒ Object
every value is transformed to json as lang es it isn’t marked es raw.
-
#initialize(name, value = nil) ⇒ JqGridOptionOrMethod
constructor
A new instance of JqGridOptionOrMethod.
- #to_s ⇒ Object
Constructor Details
#initialize(name, value = nil) ⇒ JqGridOptionOrMethod
Returns a new instance of JqGridOptionOrMethod.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/models/rails_jq_grid/jq_grid_option_or_method.rb', line 19 def initialize(name, value=nil) self.name = name if (value.is_a?(Hash)) self.type = value[:type] self.value = value[:value] else self.type = :json self.value = value end end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
17 18 19 |
# File 'app/models/rails_jq_grid/jq_grid_option_or_method.rb', line 17 def name @name end |
#type ⇒ Object
Returns the value of attribute type.
17 18 19 |
# File 'app/models/rails_jq_grid/jq_grid_option_or_method.rb', line 17 def type @type end |
#value ⇒ Object
Returns the value of attribute value.
17 18 19 |
# File 'app/models/rails_jq_grid/jq_grid_option_or_method.rb', line 17 def value @value end |
Instance Method Details
#<<(*args) ⇒ Object
works like JqGridMethodMissing.raw
33 34 35 36 37 |
# File 'app/models/rails_jq_grid/jq_grid_option_or_method.rb', line 33 def <<(*args) RAILS_DEFAULT_LOGGER.debug "#{args.inspect}" self.type = :raw self.value = args[0] end |
#escaped_name ⇒ Object
option name ist camalized with a lower start character transforms from ruby style to jqgrid style before_submit => beforeSubmit
42 43 44 |
# File 'app/models/rails_jq_grid/jq_grid_option_or_method.rb', line 42 def escaped_name self.name.to_s.camelize(:lower) end |
#escaped_value ⇒ Object
every value is transformed to json as lang es it isn’t marked es raw
48 49 50 51 52 53 54 |
# File 'app/models/rails_jq_grid/jq_grid_option_or_method.rb', line 48 def escaped_value if self.type == :raw self.value else self.value.to_json end end |
#to_s ⇒ Object
56 57 58 |
# File 'app/models/rails_jq_grid/jq_grid_option_or_method.rb', line 56 def to_s self.escaped_value end |