Module: CTioga2::Data::Filters

Defined in:
lib/ctioga2/data/filters.rb

Overview

A series of commands that can be used as “filters”, as they act upon the last Dataset pushed unto the stack.

Constant Summary collapse

FiltersGroup =
CmdGroup.new('filter', "Filters",
"The commands in this group act upon the last 
dataset pushed unto the data stack: they can be viewed as filters.", 
101)
SortOperation =
Cmd.new("sort-last", nil, "--sort-last", 
          [], {}) do |plotmaker, opts|
  plotmaker.data_stack.last.sort!
end
SortFilter =
Cmd.new("sort", nil, "--sort", 
          [], {}) do |plotmaker, opts|
  plotmaker.data_stack.add_to_dataset_hook('sort-last()')
end
TrimOperation =
Cmd.new("trim-last", nil, "--trim-last", 
          [CmdArg.new('integer')], {}) do |plotmaker, number, opts|
  plotmaker.data_stack.last.trim!(number)
end
TrimFilter =
Cmd.new("trim", nil, "--trim", 
          [CmdArg.new('integer')], {}) do |plotmaker, number, opts|
  plotmaker.data_stack.add_to_dataset_hook("trim-last(#{number})")
end
CherryPickOperation =
Cmd.new("cherry-pick-last", nil, "--cherry-pick-last", 
          [CmdArg.new('text')], {}) do |plotmaker, formula|
  plotmaker.data_stack.last.select_formula!(formula)
end
CherryPickFilter =
Cmd.new("cherry-pick", nil, "--cherry-pick", 
          [CmdArg.new('text')], {}) do |plotmaker, formula|
  plotmaker.data_stack.add_to_dataset_hook("cherry-pick-last(#{formula})")
end