Class: ResourceFull::Query::CustomParameter
- Defined in:
- lib/resource_full/query.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#include ⇒ Object
readonly
Returns the value of attribute include.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Attributes inherited from Parameter
Instance Method Summary collapse
- #allow_nil? ⇒ Boolean
- #find(finder, request_params) ⇒ Object
-
#initialize(name, resource, opts = {}) ⇒ CustomParameter
constructor
A new instance of CustomParameter.
- #negated? ⇒ Boolean
- #subclass(new_resource) ⇒ Object
Methods inherited from Parameter
#applicable_to?, #fuzzy?, #to_xml
Constructor Details
#initialize(name, resource, opts = {}) ⇒ CustomParameter
Returns a new instance of CustomParameter.
87 88 89 90 91 92 93 94 |
# File 'lib/resource_full/query.rb', line 87 def initialize(name, resource, opts={}) super(name, resource, opts) @table = table_for(opts) @columns = columns_for(name, resource, opts) @negated = opts[:negated] || false @include = opts[:from] || [] end |
Instance Attribute Details
#columns ⇒ Object (readonly)
Returns the value of attribute columns.
85 86 87 |
# File 'lib/resource_full/query.rb', line 85 def columns @columns end |
#include ⇒ Object (readonly)
Returns the value of attribute include.
85 86 87 |
# File 'lib/resource_full/query.rb', line 85 def include @include end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
85 86 87 |
# File 'lib/resource_full/query.rb', line 85 def table @table end |
Instance Method Details
#allow_nil? ⇒ Boolean
96 |
# File 'lib/resource_full/query.rb', line 96 def allow_nil?; @allow_nil; end |
#find(finder, request_params) ⇒ Object
99 100 101 102 |
# File 'lib/resource_full/query.rb', line 99 def find(finder, request_params) return finder unless applicable_to?(request_params) finder.scoped :conditions => conditions_for(request_params), :include => @include end |
#negated? ⇒ Boolean
97 |
# File 'lib/resource_full/query.rb', line 97 def negated?; @negated; end |
#subclass(new_resource) ⇒ Object
104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/resource_full/query.rb', line 104 def subclass(new_resource) new_table = if @table == @resource.model_class.table_name new_resource.model_class.table_name else @table end self.class.new(@name, new_resource, :fuzzy => @fuzzy, :allow_nil => @allow_nil, :table => new_table, :columns => @columns, :from => @include, :negated => @negated ) end |