Module: CTioga::Backends

Includes:
SciYAG
Included in:
CTable, PlotMaker
Defined in:
lib/CTioga/backends.rb

Overview

This module handles all manipulations of backends.

Instance Method Summary collapse

Instance Method Details

#backendObject



36
37
38
# File 'lib/CTioga/backends.rb', line 36

def backend
  @backend_factory.current
end

#backendsObject



40
41
42
# File 'lib/CTioga/backends.rb', line 40

def backends
  @backend_factory.instances
end

#current_push_filter(filter) ⇒ Object

Push a filter onto the current backend



50
51
52
# File 'lib/CTioga/backends.rb', line 50

def current_push_filter(filter)
  backend.push_xy_filter(filter)
end

#expand_spec(spec) ⇒ Object

Expands the current set according to the current’s backend rules



83
84
85
# File 'lib/CTioga/backends.rb', line 83

def expand_spec(spec)
  backend.expand_sets(spec)
end

#init_backend_structureObject

Initializes the backend structure.



29
30
31
32
33
34
# File 'lib/CTioga/backends.rb', line 29

def init_backend_structure
  @backend_factory = 
    MetaBuilder::Factories::UniqueFactory.new(SciYAG::Backends::Backend, 
                                              'text')
  SciYAG::Backends::Backend.logger = self.logger
end

#prepare_backend_options(op) ⇒ Object

Fills an OptionParser with the apppropriate stuff to deal with backends:



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/CTioga/backends.rb', line 56

def prepare_backend_options(op)
  op.separator "\nHow to select backends, and their options:"
  @backend_factory.option_parser_factory(op) 

  op.separator "\nFilters to apply onto data:"
  for filter_desc in SciYAG::Backends::Filter.description_list
    filter_desc.parser_instantiate_option(op,
                                          self,
                                          :current_push_filter)
  end
  op.on("--filter-pop", "Removes the last filter pushed " +
             "onto the current backend") do
    backend.pop_xy_filter
  end

  op.on("--filter-clear", "Removes all filters applying " +
             "to the current backend") do
    backend.clear_xy_filters
  end
end

#set_backend(str) ⇒ Object



44
45
46
# File 'lib/CTioga/backends.rb', line 44

def set_backend(str)
  @backend_factory.current = str
end

#xy_data_set(set) ⇒ Object

Interprets the set with the current backend and returns the data



78
79
80
# File 'lib/CTioga/backends.rb', line 78

def xy_data_set(set)
  return backend.xy_data(set) 
end