Class: MixReader::Events
Constant Summary collapse
- EVENT_SELECTORS =
%w(from_date to_date event_selectors)
- JQL_SCRIPT_MAIN =
'PARAMS function main(){return Events(params)}'
- JQL_SCRIPT_PARAMS =
"params = PARAMS_HASH;"
Constants inherited from Base
Instance Attribute Summary collapse
-
#selectors ⇒ Object
Returns the value of attribute selectors.
Attributes inherited from Base
Instance Method Summary collapse
- #build_script ⇒ Object
- #extract_selectors ⇒ Object
-
#initialize(args) ⇒ Events
constructor
A new instance of Events.
Methods inherited from Base
Constructor Details
#initialize(args) ⇒ Events
Returns a new instance of Events.
9 10 11 12 |
# File 'lib/mix_reader/events.rb', line 9 def initialize(args) super extract_selectors end |
Instance Attribute Details
#selectors ⇒ Object
Returns the value of attribute selectors.
7 8 9 |
# File 'lib/mix_reader/events.rb', line 7 def selectors @selectors end |
Instance Method Details
#build_script ⇒ Object
14 15 16 17 |
# File 'lib/mix_reader/events.rb', line 14 def build_script params = JQL_SCRIPT_PARAMS.sub("PARAMS_HASH", selectors) @script = JQL_SCRIPT_MAIN.sub("PARAMS", params) end |
#extract_selectors ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/mix_reader/events.rb', line 19 def extract_selectors query_filters = {} EVENT_SELECTORS.each do |key| value = self.filters.delete(key.to_sym) query_filters[key.to_sym] = value unless value.nil? end @selectors = query_filters.to_json end |