org_tp 0.0.5 → 0.0.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c10df83682adb368630c8fbc032f49c1fe70f1f
4
- data.tar.gz: 70c52d776a82dbe28ee1ca82015dcf9571501e5c
3
+ metadata.gz: 1a86d8ba338efcb40e6028d7f44aaf3566c78698
4
+ data.tar.gz: db53b23f2bc3f6368e633aff05ff7b289e3adb64
5
5
  SHA512:
6
- metadata.gz: 5949b282e969e2f718135f8e59ef676a72804c7536a416db10607d62e687e8f4910a8f9f91626faa5cc39d240c8a53820ed2c89ee51ddc8964b796edd9b986e2
7
- data.tar.gz: 74f188d04ce1f4bc7058242b8de9cc93887c396e1a91f2165349afb2b643ebf56b56c830bde19404f6657aaae59c2c24d736182e2959803c5aa604709d80b56c
6
+ metadata.gz: d416f1a7625484a816e546f22107b3ab683b3df75510ec009d9d2bccd8afedb9cb94fbba9273ba96f51a413e936291988111ef4fe99e640a353b6b0fd75b08dc
7
+ data.tar.gz: a05a86c3cb9fbf63cfa746b87e5133e19060239eb9ff609a1f298b83b3da14a41affa2ad2e96dfc4d574b85ae8cf46dc2dc62d3b2d4a1718e93aa1f87f034e56
@@ -20,16 +20,16 @@ tp User.limit(1)
20
20
  # >> |--------------------------+-------|
21
21
  # >> | _id | name |
22
22
  # >> |--------------------------+-------|
23
- # >> | 5988562bf6453fd586c8a492 | alice |
24
- # >> | 5988562cf6453fd586c8a493 | bob |
25
- # >> | 5988562cf6453fd586c8a494 | carol |
23
+ # >> | 598d9d05f6453f404a7a4c74 | alice |
24
+ # >> | 598d9d06f6453f404a7a4c75 | bob |
25
+ # >> | 598d9d06f6453f404a7a4c76 | carol |
26
26
  # >> |--------------------------+-------|
27
27
  # >> |------+--------------------------|
28
- # >> | _id | 5988562bf6453fd586c8a492 |
28
+ # >> | _id | 598d9d05f6453f404a7a4c74 |
29
29
  # >> | name | alice |
30
30
  # >> |------+--------------------------|
31
31
  # >> |--------------------------+-------|
32
32
  # >> | _id | name |
33
33
  # >> |--------------------------+-------|
34
- # >> | 5988562bf6453fd586c8a492 | alice |
34
+ # >> | 598d9d05f6453f404a7a4c74 | alice |
35
35
  # >> |--------------------------+-------|
@@ -4,7 +4,7 @@ module OrgTp
4
4
  ActiveSupport.on_load(:active_record) do
5
5
  include OrgTp::ActiveRecord
6
6
 
7
- ActiveRecord::Result.class_eval do
7
+ ::ActiveRecord::Result.class_eval do
8
8
  def to_t(**options)
9
9
  OrgTp.generate(collect(&:to_h), options)
10
10
  end
@@ -1,3 +1,3 @@
1
1
  module OrgTp
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
data/org_tp.gemspec CHANGED
@@ -4,27 +4,27 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'org_tp/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "org_tp"
7
+ spec.name = 'org_tp'
8
8
  spec.version = OrgTp::VERSION
9
- spec.author = "akicho8"
10
- spec.email = "akicho8@gmail.com"
11
- spec.homepage = "https://github.com/akicho8/org_tp"
12
- spec.summary = "OrgTp shows text table like emacs org-table for easy reading."
13
- spec.description = "OrgTp shows text table like emacs org-table for easy reading."
9
+ spec.author = 'akicho8'
10
+ spec.email = 'akicho8@gmail.com'
11
+ spec.homepage = 'https://github.com/akicho8/org_tp'
12
+ spec.summary = 'OrgTp shows text table like emacs org-table for easy reading.'
13
+ spec.description = 'OrgTp shows text table like emacs org-table for easy reading.'
14
14
  spec.platform = Gem::Platform::RUBY
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
- spec.rdoc_options = ["--line-numbers", "--inline-source", "--charset=UTF-8", "--diagram", "--image-format=jpg"]
19
+ spec.require_paths = ['lib']
20
+ spec.rdoc_options = ['--line-numbers', '--inline-source', '--charset=UTF-8', '--diagram', '--image-format=jpg']
21
21
 
22
- spec.add_dependency "activesupport"
22
+ spec.add_dependency 'activesupport'
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.3"
25
- spec.add_development_dependency "rake"
26
- spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency 'bundler', '~> 1.3'
25
+ spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'rspec'
27
27
 
28
- spec.add_development_dependency "activerecord"
29
- spec.add_development_dependency "sqlite3"
28
+ spec.add_development_dependency 'activerecord'
29
+ spec.add_development_dependency 'sqlite3'
30
30
  end
@@ -1,8 +1,8 @@
1
- require_relative "spec_helper"
2
- require "active_record"
1
+ require_relative 'spec_helper'
2
+ require 'active_record'
3
3
 
4
4
  ActiveRecord::Base.send(:include, OrgTp::ActiveRecord)
5
- ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
5
+ ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
6
6
  ActiveRecord::Migration.verbose = false
7
7
 
8
8
  ActiveRecord::Schema.define do
@@ -35,7 +35,7 @@ EOT
35
35
  |------+---|
36
36
  EOT
37
37
 
38
- ActiveRecord::Base.connection.select_all("select * from users").to_t.should == <<~EOT
38
+ ActiveRecord::Base.connection.select_all('select * from users').to_t.should == <<~EOT
39
39
  |----+------|
40
40
  | id | name |
41
41
  |----+------|
data/spec/org_tp_spec.rb CHANGED
@@ -1,19 +1,19 @@
1
- require_relative "spec_helper"
1
+ require_relative 'spec_helper'
2
2
 
3
3
  describe OrgTp do
4
4
  before do
5
5
  @rows = [
6
- {id: 1, name: "alice", description: "0123456789"},
7
- {id: 2, name: "bob", description: "あいうえお"},
8
- {id: 3, name: "bob"},
6
+ {id: 1, name: 'alice', description: '0123456789'},
7
+ {id: 2, name: 'bob', description: 'あいうえお'},
8
+ {id: 3, name: 'bob'},
9
9
  ]
10
10
  end
11
11
 
12
- it "empty array" do
13
- OrgTp.generate([]).should == ""
12
+ it 'empty array' do
13
+ OrgTp.generate([]).should == ''
14
14
  end
15
15
 
16
- it "フォーマット指定なし" do
16
+ it 'フォーマット指定なし' do
17
17
  OrgTp.generate(@rows).should == <<~EOT
18
18
  |----+-------+-------------|
19
19
  | id | name | description |
@@ -25,7 +25,7 @@ describe OrgTp do
25
25
  EOT
26
26
  end
27
27
 
28
- it "header: false" do
28
+ it 'header: false' do
29
29
  OrgTp.generate(@rows, header: false).should == <<~EOT
30
30
  |---+-------+------------|
31
31
  | 1 | alice | 0123456789 |
@@ -35,8 +35,8 @@ EOT
35
35
  EOT
36
36
  end
37
37
 
38
- it "padding disable" do
39
- OrgTp.generate(@rows, padding: "").should == <<~EOT
38
+ it 'padding disable' do
39
+ OrgTp.generate(@rows, padding: '').should == <<~EOT
40
40
  |--+-----+-----------|
41
41
  |id|name |description|
42
42
  |--+-----+-----------|
@@ -47,8 +47,8 @@ EOT
47
47
  EOT
48
48
  end
49
49
 
50
- describe "various to_t" do
51
- it "hash array" do
50
+ describe 'various to_t' do
51
+ it 'hash array' do
52
52
  [{a: 1}].to_t.should == <<~EOT
53
53
  |---|
54
54
  | a |
@@ -58,7 +58,7 @@ EOT
58
58
  EOT
59
59
  end
60
60
 
61
- it "Hash" do
61
+ it 'Hash' do
62
62
  {a: 1}.to_t.should == <<~EOT
63
63
  |---+---|
64
64
  | a | 1 |
@@ -66,8 +66,8 @@ EOT
66
66
  EOT
67
67
  end
68
68
 
69
- it "String Array" do
70
- ["a", "b"].to_t.should == <<~EOT
69
+ it 'String Array' do
70
+ ['a', 'b'].to_t.should == <<~EOT
71
71
  |---|
72
72
  | a |
73
73
  | b |
@@ -75,9 +75,9 @@ EOT
75
75
  EOT
76
76
  end
77
77
 
78
- it "Others" do
78
+ it 'Others' do
79
79
  1.to_t.should be_present
80
- "1".to_t.should be_present
80
+ '1'.to_t.should be_present
81
81
  Module.new.should be_present
82
82
  {[:a] => []}.to_t.should == <<~EOT
83
83
  |------+----|
@@ -86,8 +86,8 @@ EOT
86
86
  EOT
87
87
  end
88
88
 
89
- it "Array of hashes and width is correct even when value is array" do
90
- OrgTp.generate([{"a" => ["a"]}]).should == <<~EOT
89
+ it 'Array of hashes and width is correct even when value is array' do
90
+ OrgTp.generate([{'a' => ['a']}]).should == <<~EOT
91
91
  |-------|
92
92
  | a |
93
93
  |-------|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: org_tp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - akicho8
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-09 00:00:00.000000000 Z
11
+ date: 2017-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport