class Mikon::Index
Internal class for indexing
Public Class Methods
new(source, options={})
click to toggle source
# File lib/mikon/core/index.rb, line 9 def initialize(source, options={}) options = { name: nil }.merge(options) case when source.is_a?(Array) @data = Mikon::DArray.new(source) when source.is_a?(Mikon::DArray) @data = source else raise ArgumentError end @name = options[:name] end
Public Instance Methods
sort_by(&block)
click to toggle source
# File lib/mikon/core/index.rb, line 25 def sort_by(&block) return self.to_enum(:sort_by) unless block_given? Mikon::Index.new(@data.sort_by(&block)) end