Class: Remi::DataSource

Inherits:
DataSubject show all
Includes:
Testing::DataStub
Defined in:
lib/remi/cucumber.rb,
lib/remi/data_subject.rb

Direct Known Subclasses

CsvFile, DataFrame, Postgres, Salesforce

Defined Under Namespace

Classes: CsvFile, DataFrame, Postgres, Salesforce

Instance Attribute Summary

Attributes inherited from DataSubject

#fields

Instance Method Summary collapse

Methods included from Testing::DataStub

#empty_stub_df, #stub_boolean, #stub_date, #stub_datetime, #stub_decimal, #stub_df, #stub_float, #stub_integer, #stub_json, #stub_row_array, #stub_string, #stub_values

Methods inherited from DataSubject

#df=, #enforce_types, #field_symbolizer, #initialize

Constructor Details

This class inherits a constructor from Remi::DataSubject

Instance Method Details

#dfObject

Public: Access the dataframe from a DataSource

Returns a Remi::DataFrame



60
61
62
# File 'lib/remi/data_subject.rb', line 60

def df
  @dataframe ||= to_dataframe
end

#extractObject

Public: Memoized version of extract!



65
66
67
# File 'lib/remi/data_subject.rb', line 65

def extract
  @extract ||= extract!
end

#extract!Object

Public: Called to extract data from the source.

Returns data in a format that can be used to create a dataframe.

Raises:

  • (NoMethodError)


72
73
74
75
# File 'lib/remi/data_subject.rb', line 72

def extract!
  raise NoMethodError, "#{__method__} not defined for #{self.class.name}"
  @extract
end

#to_dataframeObject

Public: Converts extracted data to a dataframe

Returns a Remi::DataFrame

Raises:

  • (NoMethodError)


80
81
82
# File 'lib/remi/data_subject.rb', line 80

def to_dataframe
  raise NoMethodError, "#{__method__} not defined for #{self.class.name}"
end