dino_utils 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26957271463f283a6d0d47e533e2d0f1a43581da
4
- data.tar.gz: 04ef1eaaaa527c7fa2237449c78f273724ea04db
3
+ metadata.gz: 64a93cd0c048f073f878ffcba4b238ea2e9a666f
4
+ data.tar.gz: c747c197fc9bc23c958844d0d1563efd7903ad40
5
5
  SHA512:
6
- metadata.gz: 42f8815e9500c5fa5f3bfb93d3ad2d75b4937c97cb8c396842012f2c1f4ee88818a105a496f4eb762a5e487cc911fc7c865163b6e73033f2577bb1d215101cde
7
- data.tar.gz: a0284a045460542a43e61175730b751102d92c674978fb3ad8fe08d46046cc09a70d40253a83d6b8647f30a84d42d908422b24adff5883b29713943b7d5ac0c6
6
+ metadata.gz: 6f720d610eda32cb2da5796f021549723c8490e4ea39e4dd765b9d5fce55edf24d43e1358f466a18586f2d1ff9942880d606635ff56ed9b7048d4500ad720d46
7
+ data.tar.gz: b6665cf77b69146552577a16025963b61a78638eb3707ac2ba18319b522ac66a3d81029b033e97f4fa4c6b59ce1840284ec89fc8910e911fb9c1f559c36d5117
@@ -6,11 +6,11 @@
6
6
  # this file is here to facilitate running it.
7
7
  #
8
8
 
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
11
  Pathname.new(__FILE__).realpath)
12
12
 
13
- require 'rubygems'
14
- require 'bundler/setup'
13
+ require "rubygems"
14
+ require "bundler/setup"
15
15
 
16
- load Gem.bin_path('guard', '_guard-core')
16
+ load Gem.bin_path("guard", "_guard-core")
@@ -6,11 +6,11 @@
6
6
  # this file is here to facilitate running it.
7
7
  #
8
8
 
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
11
  Pathname.new(__FILE__).realpath)
12
12
 
13
- require 'rubygems'
14
- require 'bundler/setup'
13
+ require "rubygems"
14
+ require "bundler/setup"
15
15
 
16
- load Gem.bin_path('bundler', 'bundler')
16
+ load Gem.bin_path("bundler", "bundler")
@@ -6,11 +6,11 @@
6
6
  # this file is here to facilitate running it.
7
7
  #
8
8
 
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
11
  Pathname.new(__FILE__).realpath)
12
12
 
13
- require 'rubygems'
14
- require 'bundler/setup'
13
+ require "rubygems"
14
+ require "bundler/setup"
15
15
 
16
- load Gem.bin_path('coderay', 'coderay')
16
+ load Gem.bin_path("coderay", "coderay")
data/bin/guard CHANGED
@@ -6,11 +6,11 @@
6
6
  # this file is here to facilitate running it.
7
7
  #
8
8
 
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
11
  Pathname.new(__FILE__).realpath)
12
12
 
13
- require 'rubygems'
14
- require 'bundler/setup'
13
+ require "rubygems"
14
+ require "bundler/setup"
15
15
 
16
- load Gem.bin_path('guard', 'guard')
16
+ load Gem.bin_path("guard", "guard")
@@ -6,11 +6,11 @@
6
6
  # this file is here to facilitate running it.
7
7
  #
8
8
 
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
11
  Pathname.new(__FILE__).realpath)
12
12
 
13
- require 'rubygems'
14
- require 'bundler/setup'
13
+ require "rubygems"
14
+ require "bundler/setup"
15
15
 
16
- load Gem.bin_path('diff-lcs', 'htmldiff')
16
+ load Gem.bin_path("diff-lcs", "htmldiff")
data/bin/ldiff CHANGED
@@ -6,11 +6,11 @@
6
6
  # this file is here to facilitate running it.
7
7
  #
8
8
 
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
11
  Pathname.new(__FILE__).realpath)
12
12
 
13
- require 'rubygems'
14
- require 'bundler/setup'
13
+ require "rubygems"
14
+ require "bundler/setup"
15
15
 
16
- load Gem.bin_path('diff-lcs', 'ldiff')
16
+ load Gem.bin_path("diff-lcs", "ldiff")
data/bin/listen CHANGED
@@ -6,11 +6,11 @@
6
6
  # this file is here to facilitate running it.
7
7
  #
8
8
 
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
11
  Pathname.new(__FILE__).realpath)
12
12
 
13
- require 'rubygems'
14
- require 'bundler/setup'
13
+ require "rubygems"
14
+ require "bundler/setup"
15
15
 
16
- load Gem.bin_path('listen', 'listen')
16
+ load Gem.bin_path("listen", "listen")
data/bin/pry CHANGED
@@ -6,11 +6,11 @@
6
6
  # this file is here to facilitate running it.
7
7
  #
8
8
 
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
11
  Pathname.new(__FILE__).realpath)
12
12
 
13
- require 'rubygems'
14
- require 'bundler/setup'
13
+ require "rubygems"
14
+ require "bundler/setup"
15
15
 
16
- load Gem.bin_path('pry', 'pry')
16
+ load Gem.bin_path("pry", "pry")
data/bin/rake CHANGED
@@ -6,11 +6,11 @@
6
6
  # this file is here to facilitate running it.
7
7
  #
8
8
 
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
11
  Pathname.new(__FILE__).realpath)
12
12
 
13
- require 'rubygems'
14
- require 'bundler/setup'
13
+ require "rubygems"
14
+ require "bundler/setup"
15
15
 
16
- load Gem.bin_path('rake', 'rake')
16
+ load Gem.bin_path("rake", "rake")
data/bin/rspec CHANGED
@@ -6,11 +6,11 @@
6
6
  # this file is here to facilitate running it.
7
7
  #
8
8
 
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
11
  Pathname.new(__FILE__).realpath)
12
12
 
13
- require 'rubygems'
14
- require 'bundler/setup'
13
+ require "rubygems"
14
+ require "bundler/setup"
15
15
 
16
- load Gem.bin_path('rspec-core', 'rspec')
16
+ load Gem.bin_path("rspec-core", "rspec")
@@ -6,11 +6,11 @@
6
6
  # this file is here to facilitate running it.
7
7
  #
8
8
 
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
11
  Pathname.new(__FILE__).realpath)
12
12
 
13
- require 'rubygems'
14
- require 'bundler/setup'
13
+ require "rubygems"
14
+ require "bundler/setup"
15
15
 
16
- load Gem.bin_path('safe_yaml', 'safe_yaml')
16
+ load Gem.bin_path("safe_yaml", "safe_yaml")
data/bin/thor CHANGED
@@ -6,11 +6,11 @@
6
6
  # this file is here to facilitate running it.
7
7
  #
8
8
 
9
- require 'pathname'
10
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
9
+ require "pathname"
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
11
11
  Pathname.new(__FILE__).realpath)
12
12
 
13
- require 'rubygems'
14
- require 'bundler/setup'
13
+ require "rubygems"
14
+ require "bundler/setup"
15
15
 
16
- load Gem.bin_path('thor', 'thor')
16
+ load Gem.bin_path("thor", "thor")
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.8"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
23
  spec.add_dependency "activerecord", ">= 3"
24
+ spec.add_dependency "hashie", ">= 0"
24
25
  spec.add_dependency "faraday"
25
26
  spec.add_dependency "faraday_middleware"
26
27
  spec.add_dependency "faraday-conductivity"
@@ -23,9 +23,7 @@ module Dino
23
23
  data_copy = {}
24
24
  data ||= []
25
25
  data.each do |k, v|
26
- if v.kind_of?(Hash)
27
- v = klass.column_for_attribute(k).type_cast_for_database(v)
28
- end
26
+ v = klass.column_for_attribute(k).type_cast_for_database(v) if v.is_a?(Hash)
29
27
  data_copy[k] = v
30
28
  end
31
29
  begin
@@ -1,3 +1,3 @@
1
1
  module DinoUtils
2
- VERSION = "0.1.12"
2
+ VERSION = "0.1.13".freeze
3
3
  end
data/lib/tn.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  module TN
2
-
3
- def self.execute_sql sql, *placeholders
2
+ def self.execute_sql(sql, *placeholders)
4
3
  ActiveRecord::Base.connection.select_value(ActiveRecord::Base.send(:sanitize_sql_array, [sql, *placeholders]))
5
4
  end
6
-
7
5
  end
@@ -33,7 +33,7 @@ class TN::AdvisoryLock
33
33
  true
34
34
  end
35
35
 
36
- private
36
+ private
37
37
 
38
38
  def acquired?
39
39
  TN.execute_sql("select #{sql_function}(#{@key})") != "f"
@@ -21,7 +21,7 @@ module TN::CSVBuilder
21
21
  row_data << row[key]
22
22
  end
23
23
  row.each do |key, _|
24
- fail "#{key} not a valid csv header!" unless csv_headers.has_key?(key)
24
+ fail "#{key} not a valid csv header!" unless csv_headers.key?(key)
25
25
  end
26
26
  csv << CSV::Row.new(csv_headers, row_data)
27
27
  csv.flush if flush_after_each_row
@@ -33,9 +33,7 @@ module TN::CSVBuilder
33
33
  file = TN::TempFile.new
34
34
  csv(file, flush_after_each_row: flush_after_each_row)
35
35
  file.close
36
- if block_given?
37
- yield(file)
38
- end
36
+ yield(file) if block_given?
39
37
  file
40
38
  end
41
39
 
@@ -9,12 +9,12 @@ module TN
9
9
  def call(env)
10
10
  @app.call(env)
11
11
  rescue Faraday::ClientError => e
12
- raise ClientError.new(e)
12
+ raise ClientError, e
13
13
  end
14
14
  end
15
15
 
16
- def self.default_connection
17
- Faraday.new do |conn|
16
+ def self.default_connection(*arguments)
17
+ Faraday.new(*arguments) do |conn|
18
18
  conn.use TN::HTTP::WrapError
19
19
  conn.use Faraday::Response::RaiseError
20
20
  yield conn if block_given?
@@ -22,15 +22,15 @@ module TN
22
22
  end
23
23
  end
24
24
 
25
- def self.form_connection
26
- default_connection do |conn|
25
+ def self.form_connection(*arguments)
26
+ default_connection(*arguments) do |conn|
27
27
  conn.request :url_encoded
28
28
  yield conn if block_given?
29
29
  end
30
30
  end
31
31
 
32
- def self.default_json_connection
33
- default_connection do |conn|
32
+ def self.default_json_connection(*arguments)
33
+ default_connection(*arguments) do |conn|
34
34
  conn.response :mashify
35
35
  conn.response :json
36
36
  yield conn if block_given?
@@ -1,7 +1,6 @@
1
1
  module TN
2
2
  class TempFile
3
-
4
- def initialize(content:nil, file:nil, name: 'tanga')
3
+ def initialize(content: nil, file: nil, name: 'tanga')
5
4
  extension = File.extname(name)
6
5
  file_name = SecureRandom.hex
7
6
  @file = file || ::Tempfile.new([file_name, extension])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dino_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Van Dyk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-26 00:00:00.000000000 Z
11
+ date: 2016-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3'
55
+ - !ruby/object:Gem::Dependency
56
+ name: hashie
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: faraday
57
71
  requirement: !ruby/object:Gem::Requirement