Module: DbAgile::Contract::Data::Dataset

Defined in:
lib/dbagile/contract/data/dataset.rb

Instance Method Summary collapse

Instance Method Details

#allbut(*cs) ⇒ Object

Makes an allbut selection



7
8
9
10
# File 'lib/dbagile/contract/data/dataset.rb', line 7

def allbut(*cs)
  arr = self.columns - cs.flatten
  select(*arr)
end

#to_csv(buffer = "", options = {}) ⇒ ...

Outputs this dataset as a CSV string.

Returns:

  • (...)

    the buffer itself



17
18
19
# File 'lib/dbagile/contract/data/dataset.rb', line 17

def to_csv(buffer = "", options = {})
  DbAgile::IO::CSV::to_csv(self, self.columns, buffer, options)
end

#to_html(buffer = "", options = {}) ⇒ ...

Outputs this dataset as a HTML string

Returns:

  • (...)

    the buffer itself



53
54
55
# File 'lib/dbagile/contract/data/dataset.rb', line 53

def to_html(buffer = "", options = {})
  DbAgile::IO::HTML::to_html(self, self.columns, buffer, options)
end

#to_json(buffer = "", options = {}) ⇒ ...

Outputs this dataset as a JSON string

Returns:

  • (...)

    the buffer itself



26
27
28
# File 'lib/dbagile/contract/data/dataset.rb', line 26

def to_json(buffer = "", options = {})
  DbAgile::IO::JSON::to_json(self.to_a, self.columns, buffer, options)
end

#to_ruby(buffer = "", options = {}) ⇒ ...

Outputs this dataset as a Ruby Array of hashes string

Returns:

  • (...)

    the buffer itself



62
63
64
# File 'lib/dbagile/contract/data/dataset.rb', line 62

def to_ruby(buffer = "", options = {})
  DbAgile::IO::Ruby::to_ruby(self, self.columns, buffer, options)
end

#to_text(buffer = "", options = {}) ⇒ ...

Outputs this dataset as plain text

Returns:

  • (...)

    the buffer itself



71
72
73
# File 'lib/dbagile/contract/data/dataset.rb', line 71

def to_text(buffer = "", options = {})
  DbAgile::IO::Text::to_text(self, self.columns, buffer, options)
end

#to_xml(buffer = "", options = {}) ⇒ ...

Outputs this dataset as a XML string

Returns:

  • (...)

    the buffer itself



44
45
46
# File 'lib/dbagile/contract/data/dataset.rb', line 44

def to_xml(buffer = "", options = {})
  DbAgile::IO::XML::to_xml(self, self.columns, buffer, options)
end

#to_yaml(buffer = "", options = {}) ⇒ ...

Outputs this dataset as a YAML string

Returns:

  • (...)

    the buffer itself



35
36
37
# File 'lib/dbagile/contract/data/dataset.rb', line 35

def to_yaml(buffer = "", options = {})
  DbAgile::IO::YAML::to_yaml(self.to_a, self.columns, buffer, options)
end