Class: WIP::CLI::Index

Inherits:
Base
  • Object
show all
Defined in:
lib/wip/cli/index.rb

Instance Attribute Summary

Attributes inherited from Base

#config, #path

Instance Method Summary collapse

Constructor Details

#initializeIndex

Returns a new instance of Index.



4
5
6
# File 'lib/wip/cli/index.rb', line 4

def initialize(*)
  super
end

Instance Method Details

#get(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/wip/cli/index.rb', line 8

def get(options = {})
  result = index.select do |entry|
    entry[:path].match(/^#{context}/)
  end

  return result.sort_by { |entry| entry[:"#{options[:sort]}"] } if options[:sort]
  return result
end