Sha256: 56baf6c3eaa6d20eb07127b532bbc3564b5a1d9ea0b9c2b2b788efb238dfc1be

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

# Rail trip's persistence schema is defined using a domain-specific language
# provided by [Data Miner](http://github.com/seamusabshere/data_miner).
module BrighterPlanet
  module RailTrip

    #### Rail trip: persistence schema
    # This module is used by [Brighter Planet](http://brighterplanet.com)'s
    # [emission estimate service](http://carbon.brighterplanet.com) to provide
    # a persistence structure, which is in turn used by the [characterization](characterization.html).
    #
    # For more information see:
    #
    #   * [API documentation](http://carbon.brighterplanet.com/rail_trips/options)
    #   * [Source code](http://github.com/brighterplanet/rail_trip)
    #
    module Data
      def self.included(base)
        ##### The carbon model
        base.data_miner do
          # This `schema` block encapsulates the persistence schema.
          schema do
            string  'name'
            date    'date'
            float   'duration'
            float   'distance_estimate'
            string  'rail_class_id'
          end

          # This `process` block indicates that RailTrip's associated classes
          # should populate themselves according to their own DataMiner
          # instructions.
          process :run_data_miner_on_belongs_to_associations
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rail_trip-0.0.12 lib/rail_trip/data.rb
rail_trip-0.0.11 lib/rail_trip/data.rb