seed_sort_toolkit 0.0.1 → 0.0.2

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: da0d6d591ebfafaee0790f1e9507d1532cdb8759
4
- data.tar.gz: 23c1edb14b9c9f8bfbef92958a97414b34389ac0
3
+ metadata.gz: ff0504ff51ad5de97ecefa7ab17e8f7badec6fff
4
+ data.tar.gz: af8cedb3db6fa53bebd56a473180d5cefc9db9c7
5
5
  SHA512:
6
- metadata.gz: 9c89255d6e78434d092a8377ff947a462157c2163ec60632716b7a0dd4f22281d55f26452f670e4b2567c26529bf06698ec3260a88b14ca4eb4e957c18b51edb
7
- data.tar.gz: 2ecefbde36076cf92e494b2d8ed02c145c3f34ff0a613df74f905eebc53374eacc28f91fc2dcf53fcb8617e0b47d3427f3de3693af79f014f8c40b947b813433
6
+ metadata.gz: 270febf06becf8d21fcf28763bd9b27736bc6e8f9d94bb202c55780802746376c710ecfe64c5bb70f9c874fe9afab74f9428cbbb84071d6152cf0cbd07366c07
7
+ data.tar.gz: ee0d1e86141207d94dbd6b174162c7e9fe7388061a08d06e19df7d77fe50d11b025872aef7008293f09a7bacc34686d1c1ffffa150d27fcc384dc7c919588a61
data/README.md CHANGED
@@ -1,18 +1,21 @@
1
+ [![Gem Version](https://badge.fury.io/rb/seed_sort_toolkit.svg)](http://badge.fury.io/rb/seed_sort_toolkit)
1
2
  [![Build Status](https://travis-ci.org/Shinya131/seed_sort_toolkit.svg?branch=master)](https://travis-ci.org/Shinya131/seed_sort_toolkit)
2
3
  [![Coverage Status](https://coveralls.io/repos/Shinya131/seed_sort_toolkit/badge.png)](https://coveralls.io/r/Shinya131/seed_sort_toolkit)
3
4
  [![Code Climate](https://codeclimate.com/github/Shinya131/seed_sort_toolkit/badges/gpa.svg)](https://codeclimate.com/github/Shinya131/seed_sort_toolkit)
5
+ [![Dependency Status](https://gemnasium.com/Shinya131/seed_sort_toolkit.svg)](https://gemnasium.com/Shinya131/seed_sort_toolkit)
4
6
 
5
7
  # SeedSortToolkit
6
8
 
7
9
  `SeedSortToolkit` is rails seed file sort tool.
8
10
  This tool can without changing the content & format, just replace only order.
9
11
 
10
- note:
11
- If you use `YAML.load` and sort and `YAML.dump`.
12
- The format of your seed, diff comes out a little.
13
- For example:
14
- - Quotes for string will be disappears.
15
- - nil column will be blank.
12
+ ### note:
13
+ If you use `YAML.load` and sort and `YAML.dump`.
14
+ The format of your seed, diff comes out a little.
15
+
16
+ For example:
17
+ - Quotes(`""`,`''`) for string will be disappears.
18
+ - `nil` column will be blank.
16
19
 
17
20
  This tool does not cause the above problem.
18
21
 
@@ -1,24 +1,26 @@
1
1
  require 'accessible_seed_yaml'
2
2
 
3
- class SortableSeedYaml
4
- def initialize(seed)
5
- seed = AccessibleSeedYaml::Table.new(seed)
6
- @records = seed.records
3
+ module SeedSortToolkit
4
+ class SortableSeedYaml
5
+ def initialize(seed)
6
+ seed = AccessibleSeedYaml::Table.new(seed)
7
+ @records = seed.records
8
+ end
9
+
10
+ def sort_by(&block)
11
+ @records.sort_by!(&block)
12
+ fetch_seed
13
+ end
14
+
15
+ def sort(&block)
16
+ @records.sort!(&block)
17
+ fetch_seed
18
+ end
19
+
20
+ private
21
+
22
+ def fetch_seed
23
+ @records.map(&:original_seed).join
24
+ end
7
25
  end
8
-
9
- def sort_by(&block)
10
- @records.sort_by!(&block)
11
- fetch_seed
12
- end
13
-
14
- def sort(&block)
15
- @records.sort!(&block)
16
- fetch_seed
17
- end
18
-
19
- private
20
-
21
- def fetch_seed
22
- @records.map(&:original_seed).join
23
- end
24
- end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module SeedSortToolkit
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -4,7 +4,7 @@ MiniTest::Unit.autorun
4
4
 
5
5
  class TestSortableSeedYaml < MiniTest::Unit::TestCase
6
6
  def setup
7
- @sortable_seed = SortableSeedYaml.new(TestData::Seed::RandomOrder)
7
+ @sortable_seed = SeedSortToolkit::SortableSeedYaml.new(TestData::Seed::RandomOrder)
8
8
  end
9
9
 
10
10
  def test_sort_by
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seed_sort_toolkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shinya131