Class: MockWS::DataManager
- Inherits:
-
Object
- Object
- MockWS::DataManager
- Extended by:
- Carioca::Injector
- Defined in:
- lib/mockws/data_manager.rb
Constant Summary collapse
- DEFAULT_OUTPUT_TYPE =
:json
- TYPE_MAP =
{ json: "application/json", csv: "application/csv", yaml: "application/x-yaml" }
- @@default_output_type =
(configuration.settings.output.type)? configuration.settings.output.type : DEFAULT_OUTPUT_TYPE
Class Method Summary collapse
- .from_csv(file) ⇒ Object
- .from_json(file) ⇒ Object
- .from_yaml(file) ⇒ Object
- .to_csv(data) ⇒ Object
- .to_json(data) ⇒ Object
- .to_yaml(data) ⇒ Object
Instance Method Summary collapse
Class Method Details
.from_csv(file) ⇒ Object
16 17 18 |
# File 'lib/mockws/data_manager.rb', line 16 def self.from_csv(file) return CSV.read file end |
.from_json(file) ⇒ Object
21 22 23 |
# File 'lib/mockws/data_manager.rb', line 21 def self.from_json(file) return JSON.load file end |
.from_yaml(file) ⇒ Object
25 26 27 |
# File 'lib/mockws/data_manager.rb', line 25 def self.from_yaml(file) return YAML.load_file file end |
.to_csv(data) ⇒ Object
34 35 36 |
# File 'lib/mockws/data_manager.rb', line 34 def self.to_csv(data) return data.to_csv end |
.to_json(data) ⇒ Object
30 31 32 |
# File 'lib/mockws/data_manager.rb', line 30 def self.to_json(data) return data.to_json end |
.to_yaml(data) ⇒ Object
38 39 40 |
# File 'lib/mockws/data_manager.rb', line 38 def self.to_yaml(data) return data.to_yaml end |
Instance Method Details
#default_output_type ⇒ Object
12 13 14 |
# File 'lib/mockws/data_manager.rb', line 12 def default_output_type return @@default_output_type end |