Class: Appydave::Tools::RandomContext::QueryEntry
- Inherits:
-
Object
- Object
- Appydave::Tools::RandomContext::QueryEntry
- Defined in:
- lib/appydave/tools/random_context/query_entry.rb
Overview
Represents one entry in the random-queries.yml config file
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#max_results ⇒ Object
readonly
Returns the value of attribute max_results.
-
#min_results ⇒ Object
readonly
Returns the value of attribute min_results.
Instance Method Summary collapse
- #good_count?(count) ⇒ Boolean
-
#initialize(data) ⇒ QueryEntry
constructor
A new instance of QueryEntry.
Constructor Details
#initialize(data) ⇒ QueryEntry
Returns a new instance of QueryEntry.
10 11 12 13 14 15 |
# File 'lib/appydave/tools/random_context/query_entry.rb', line 10 def initialize(data) @label = data['label'] @command = data['command'] @min_results = data.fetch('min_results', 1) @max_results = data.fetch('max_results', 15) end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
8 9 10 |
# File 'lib/appydave/tools/random_context/query_entry.rb', line 8 def command @command end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
8 9 10 |
# File 'lib/appydave/tools/random_context/query_entry.rb', line 8 def label @label end |
#max_results ⇒ Object (readonly)
Returns the value of attribute max_results.
8 9 10 |
# File 'lib/appydave/tools/random_context/query_entry.rb', line 8 def max_results @max_results end |
#min_results ⇒ Object (readonly)
Returns the value of attribute min_results.
8 9 10 |
# File 'lib/appydave/tools/random_context/query_entry.rb', line 8 def min_results @min_results end |
Instance Method Details
#good_count?(count) ⇒ Boolean
17 18 19 |
# File 'lib/appydave/tools/random_context/query_entry.rb', line 17 def good_count?(count) count.between?(min_results, max_results) end |