Module: Daru

Extended by:
Configuration
Defined in:
lib/daru.rb,
lib/daru/io/io.rb,
lib/daru/vector.rb,
lib/daru/version.rb,
lib/daru/category.rb,
lib/daru/dataframe.rb,
lib/daru/core/merge.rb,
lib/daru/core/query.rb,
lib/daru/index/index.rb,
lib/daru/configuration.rb,
lib/daru/core/group_by.rb,
lib/daru/helpers/array.rb,
lib/daru/iruby/helpers.rb,
lib/daru/date_time/index.rb,
lib/daru/formatters/table.rb,
lib/daru/date_time/offsets.rb,
lib/daru/extensions/rserve.rb,
lib/daru/index/multi_index.rb,
lib/daru/io/csv/converters.rb,
lib/daru/io/sql_data_source.rb,
lib/daru/extensions/which_dsl.rb,
lib/daru/accessors/gsl_wrapper.rb,
lib/daru/plotting/gruff/vector.rb,
lib/daru/accessors/array_wrapper.rb,
lib/daru/index/categorical_index.rb,
lib/daru/maths/arithmetic/vector.rb,
lib/daru/maths/statistics/vector.rb,
lib/daru/plotting/gruff/category.rb,
lib/daru/plotting/nyaplot/vector.rb,
lib/daru/plotting/gruff/dataframe.rb,
lib/daru/accessors/mdarray_wrapper.rb,
lib/daru/accessors/nmatrix_wrapper.rb,
lib/daru/plotting/nyaplot/category.rb,
lib/daru/accessors/dataframe_by_row.rb,
lib/daru/maths/arithmetic/dataframe.rb,
lib/daru/maths/statistics/dataframe.rb,
lib/daru/plotting/nyaplot/dataframe.rb

Overview

Support for a simple query DSL for accessing where(), inspired by gem “squeel”

Defined Under Namespace

Modules: Accessors, ArrayHelper, Category, Configuration, Core, DateTimeIndexHelper, Formatters, IO, IOHelpers, IRuby, Maths, Offsets, Plotting Classes: CategoricalIndex, DataFrame, DateOffset, DateTimeIndex, Index, MultiIndex, NegativeDateOffset, Vector, WhichQuery

Constant Summary collapse

DAYS_OF_WEEK =
{
  'SUN' => 0,
  'MON' => 1,
  'TUE' => 2,
  'WED' => 3,
  'THU' => 4,
  'FRI' => 5,
  'SAT' => 6
}.freeze
MONTH_DAYS =
{
  1 => 31,
  2 => 28,
  3 => 31,
  4 => 30,
  5 => 31,
  6 => 30,
  7 => 31,
  8 => 31,
  9 => 30,
  10 => 31,
  11 => 30,
  12 => 31
}.freeze
MISSING_VALUES =
[nil, Float::NAN].freeze
SPLIT_TOKEN =
','.freeze
VERSION =
'0.3'.freeze

Constants included from Configuration

Configuration::DEFAULT_MAX_ROWS, Configuration::DEFAULT_SPACING, Configuration::INSPECT_OPTIONS_KEYS

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Configuration

configure, extended, reset_options

Class Attribute Details

.error_streamObject

A variable which will set whether Vector metadata is updated immediately or lazily. Call the #update method every time a values are set or removed in order to update metadata like positions of missing values.



47
48
49
# File 'lib/daru.rb', line 47

def error_stream
  @error_stream
end

.lazy_updateObject

A variable which will set whether Vector metadata is updated immediately or lazily. Call the #update method every time a values are set or removed in order to update metadata like positions of missing values.



47
48
49
# File 'lib/daru.rb', line 47

def lazy_update
  @lazy_update
end

.plotting_libraryObject

Returns the value of attribute plotting_library.



48
49
50
# File 'lib/daru.rb', line 48

def plotting_library
  @plotting_library
end

Class Method Details

.create_has_library(library) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/daru.rb', line 50

def create_has_library(library)
  lib_underscore = library.to_s.tr('-', '_')
  define_singleton_method("has_#{lib_underscore}?") do
    cv = "@@#{lib_underscore}"
    unless class_variable_defined? cv
      begin
        library = 'nmatrix/nmatrix' if library == :nmatrix
        require library.to_s
        class_variable_set(cv, true)
      rescue LoadError
        # :nocov:
        class_variable_set(cv, false)
        # :nocov:
      end
    end
    class_variable_get(cv)
  end
end

.error(msg) ⇒ Object



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

def error msg
  error_stream.puts msg if error_stream
end