Sha256: ec9d74b165a7871c9af119b8be3c6e256259d1c82e617ed8a6268189c5a0b0ed
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
module RailsConnector class ObjParamsParser def initialize(host, port) @host = host @port = port end def parse(obj, params) raise "Required parameter 'obj' is missing." unless params.present? raise "Parameter 'obj' is not a hash." unless params.is_a?(Hash) if obj convert_params(params, obj) if widget_pool_params = params['_widget_pool'] convert_widget_pool_params(widget_pool_params, obj) end end params end private def convert_widget_pool_params(widget_pool_params, obj) widget_pool_params.each_pair do |widget_id, widget_params| widget = obj.widget_from_pool(widget_id) if widget_params.present? convert_params(widget_params, widget) end end end def convert_params(params, obj) params.each do |key, value| type = obj.type_of_attribute(key.to_s) params[key] = case type when 'html' ContentConversion.convert_html_links(value, @host, @port) when 'linklist' ContentConversion.convert_linklist_urls(value, @host, @port) else value end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
infopark_cloud_connector-7.1.0 | lib/rails_connector/obj_params_parser.rb |