Sha256: 1f829f942a84f7e8ea122efe58e9c405376658ef5b730e3761c1b6f010197498

Contents?: true

Size: 387 Bytes

Versions: 1

Compression:

Stored size: 387 Bytes

Contents

require 'accessible_seed_yaml'

class SortableSeedYaml
  def initialize(seed)
    seed = AccessibleSeedYaml::Table.new(seed)
    @records = seed.records
  end
  
  def sort_by(&block)
    @records.sort_by!(&block)
    fetch_seed
  end
  
  def sort(&block)
    @records.sort!(&block)
    fetch_seed
  end
  
  private
  
  def fetch_seed
    @records.map(&:original_seed).join
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
seed_sort_toolkit-0.0.1 lib/seed_sort_toolkit/sortable_seed_yaml.rb