Class: SeedSortToolkit::SortableSeedYaml

Inherits:
Object
  • Object
show all
Defined in:
lib/seed_sort_toolkit/sortable_seed_yaml.rb

Instance Method Summary collapse

Constructor Details

#initialize(seed) ⇒ SortableSeedYaml

Returns a new instance of SortableSeedYaml.



5
6
7
8
# File 'lib/seed_sort_toolkit/sortable_seed_yaml.rb', line 5

def initialize(seed)
  seed = AccessibleSeedYaml::Table.new(seed)
  @records = seed.records
end

Instance Method Details

#sort(&block) ⇒ Object



15
16
17
18
# File 'lib/seed_sort_toolkit/sortable_seed_yaml.rb', line 15

def sort(&block)
  @records.sort!(&block)
  fetch_seed
end

#sort_by(&block) ⇒ Object



10
11
12
13
# File 'lib/seed_sort_toolkit/sortable_seed_yaml.rb', line 10

def sort_by(&block)
  @records.sort_by!(&block)
  fetch_seed
end