Class: CodeStock::Query
- Inherits:
-
Object
- Object
- CodeStock::Query
- Defined in:
- lib/codestock/cdweb/lib/query.rb
Constant Summary collapse
- OPTIONS =
[ ['package', 'p'], ['filepath', 'fpath', 'f'], ['suffix', 's'], ]
Instance Attribute Summary collapse
-
#query_string ⇒ Object
readonly
Returns the value of attribute query_string.
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #escape_html ⇒ Object
- #fpaths ⇒ Object
-
#initialize(str) ⇒ Query
constructor
A new instance of Query.
- #keywords ⇒ Object
- #packages ⇒ Object
- #suffixs ⇒ Object
Constructor Details
#initialize(str) ⇒ Query
Returns a new instance of Query.
21 22 23 24 25 |
# File 'lib/codestock/cdweb/lib/query.rb', line 21 def initialize(str) @query_string = str init_hash parse end |
Instance Attribute Details
#query_string ⇒ Object (readonly)
Returns the value of attribute query_string.
13 14 15 |
# File 'lib/codestock/cdweb/lib/query.rb', line 13 def query_string @query_string end |
Instance Method Details
#empty? ⇒ Boolean
31 32 33 |
# File 'lib/codestock/cdweb/lib/query.rb', line 31 def empty? keywords.size == 0 && packages.size == 0 && fpaths.size == 0 && suffixs.size == 0 end |
#escape_html ⇒ Object
27 28 29 |
# File 'lib/codestock/cdweb/lib/query.rb', line 27 def escape_html Rack::Utils::escape_html(@query_string) end |
#fpaths ⇒ Object
43 44 45 |
# File 'lib/codestock/cdweb/lib/query.rb', line 43 def fpaths calc_param(1) end |
#keywords ⇒ Object
35 36 37 |
# File 'lib/codestock/cdweb/lib/query.rb', line 35 def keywords @hash['keywords'] end |
#packages ⇒ Object
39 40 41 |
# File 'lib/codestock/cdweb/lib/query.rb', line 39 def packages calc_param(0) end |
#suffixs ⇒ Object
47 48 49 |
# File 'lib/codestock/cdweb/lib/query.rb', line 47 def suffixs calc_param(2) end |