Class: Filter8::Request
- Inherits:
-
Object
- Object
- Filter8::Request
- Defined in:
- lib/filter8/request.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
Instance Method Summary collapse
-
#initialize(content, options = {}) ⇒ Request
constructor
A new instance of Request.
- #request_params ⇒ Object
Constructor Details
#initialize(content, options = {}) ⇒ Request
Returns a new instance of Request.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/filter8/request.rb', line 5 def initialize(content, = {}) if content.is_a? Hash @content = content[:content] raise Exception.new("No value for 'content' given") if @content.nil? = content.reject!{ |k| k == :content } else @content = content end .each do |filter_name, | (filter_name, ) instance_variable_value = nil if .is_a? Hash instance_variable_value = { enabled: true } instance_variable_value = instance_variable_value.merge() else instance_variable_value = end instance_variable_set("@#{filter_name}", instance_variable_value) self.class.send(:attr_accessor, filter_name) end end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
3 4 5 |
# File 'lib/filter8/request.rb', line 3 def content @content end |
Instance Method Details
#request_params ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/filter8/request.rb', line 29 def request_params request_params = "content=#{self.content}" Filter8::AVAILABLE_FILTERS.each do |filter_name| if self.respond_to?(filter_name) && !self.send(filter_name).nil? request_params = request_params + "&" + (filter_name) end end request_params end |