quandl_data 0.0.5 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  /Gemfile.lock
2
2
  /pkg
3
3
  /tmp
4
- quandl_data-*
4
+ *.gem
5
+ *.log
@@ -0,0 +1,21 @@
1
+ module Quandl
2
+ module Data
3
+ class Table
4
+
5
+ module Loggable
6
+
7
+ extend ActiveSupport::Concern
8
+
9
+ def to_h
10
+ Quandl::Logger.info_with_elapsed("Quandl::Data::Table.to_h"){ super }
11
+ end
12
+
13
+ def to_csv
14
+ Quandl::Logger.info_with_elapsed("Quandl::Data::Table.to_csv"){ super }
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+ end
21
+ end
@@ -30,7 +30,10 @@ module Operations
30
30
  end
31
31
 
32
32
  def to_csv
33
- data_array.collect(&:to_csv).join
33
+ return data_array.collect(&:to_csv).join if data_array?
34
+ return pristine_data.collect(&:to_csv).join if pristine_data.kind_of?(Array)
35
+ return pristine_data if pristine_data.kind_of?(String)
36
+ return ''
34
37
  end
35
38
 
36
39
  def to_jd
@@ -1,3 +1,4 @@
1
+ require 'quandl/data/table/loggable'
1
2
  require 'quandl/data/table/operations'
2
3
 
3
4
  module Quandl
@@ -6,22 +7,28 @@ module Data
6
7
  class Table
7
8
 
8
9
  include Operations
10
+ include Loggable
9
11
 
10
12
  delegate *Array.forwardable_methods, to: :data_array
13
+
14
+ attr_accessor :pristine_data
11
15
 
12
16
  def initialize(*args)
13
- data = args.first
17
+ self.pristine_data = args.first
14
18
  self.attributes = args.extract_options!
15
- self.data_array = data
16
19
  end
17
-
20
+
18
21
  def data_array
19
- @data_array ||= []
22
+ @data_array ||= parse( pristine_data )
20
23
  end
21
24
 
22
25
  def data_array=(data)
23
26
  @data_array = parse(data)
24
27
  end
28
+
29
+ def data_array?
30
+ @data_array.present?
31
+ end
25
32
 
26
33
  def attributes
27
34
  @attributes ||= {}
@@ -31,7 +38,7 @@ class Table
31
38
  assign_attributes(attrs)
32
39
  attributes
33
40
  end
34
-
41
+
35
42
  # mass assignment protection
36
43
  def assign_attributes(attrs)
37
44
  attrs.each do |name, value|
@@ -1,5 +1,5 @@
1
1
  module Quandl
2
2
  module Data
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
data/quandl_data.gemspec CHANGED
@@ -22,5 +22,5 @@ Gem::Specification.new do |s|
22
22
  s.add_development_dependency "fivemat", "~> 1.2"
23
23
 
24
24
  s.add_runtime_dependency "activesupport", ">= 3.0.0"
25
- s.add_runtime_dependency "quandl_operation", "~> 0.0.8"
25
+ s.add_runtime_dependency "quandl_operation", ">= 0.0.11"
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quandl_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-20 00:00:00.000000000 Z
12
+ date: 2013-07-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -80,17 +80,17 @@ dependencies:
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
- - - ~>
83
+ - - '>='
84
84
  - !ruby/object:Gem::Version
85
- version: 0.0.8
85
+ version: 0.0.11
86
86
  type: :runtime
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
- - - ~>
91
+ - - '>='
92
92
  - !ruby/object:Gem::Version
93
- version: 0.0.8
93
+ version: 0.0.11
94
94
  description: Data will be interfaced
95
95
  email:
96
96
  - blake@hilscher.ca
@@ -110,6 +110,7 @@ files:
110
110
  - lib/quandl/data.rb
111
111
  - lib/quandl/data/random.rb
112
112
  - lib/quandl/data/table.rb
113
+ - lib/quandl/data/table/loggable.rb
113
114
  - lib/quandl/data/table/operations.rb
114
115
  - lib/quandl/data/version.rb
115
116
  - quandl_data.gemspec