Class: Cardio::Mod::Sow

Inherits:
Object
  • Object
show all
Defined in:
lib/cardio/mod/sow.rb

Overview

The Sow class is for exporting data to mods’ data directories so that they can be used as seed data when the mod is installed.

docs.google.com/document/d/13K_ynFwfpHwc3t5gnLeAkZJZHco1wK063nJNYwU8qfc/edit#

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Sow

Returns a new instance of Sow.



8
9
10
11
12
13
14
15
# File 'lib/cardio/mod/sow.rb', line 8

def initialize **args
  @mod = args[:mod]
  @name = args[:name]
  @cql = args[:cql]
  @podtype = args[:podtype] || (Rails.env.test? ? :test : :real)
  @items = args[:items]
  @field_tags = args[:field_tags]
end

Instance Method Details

#outObject

if output mod given,



18
19
20
21
22
23
24
25
26
# File 'lib/cardio/mod/sow.rb', line 18

def out
  Card::Cache.reset_all
  @mod ? dump : puts(new_data.to_yaml.yellow)
  :success
rescue Card::Error::NotFound => e
  e.message
rescue JSON::ParserError => e
  e.message
end