Class: Amiba::Source::CategoryScope
- Inherits:
-
Object
- Object
- Amiba::Source::CategoryScope
- Includes:
- Repo
- Defined in:
- lib/amiba/source/entry_finder.rb
Instance Method Summary collapse
- #apply ⇒ Object
- #entry_files ⇒ Object
-
#initialize(category = :all) ⇒ CategoryScope
constructor
A new instance of CategoryScope.
Methods included from Repo
#add_and_commit, #init, #last_commit_date, #last_commit_dates, #pull, #push, #repo
Constructor Details
#initialize(category = :all) ⇒ CategoryScope
Returns a new instance of CategoryScope.
102 103 104 |
# File 'lib/amiba/source/entry_finder.rb', line 102 def initialize(category = :all) @category = category end |
Instance Method Details
#apply ⇒ Object
105 106 107 108 109 110 111 |
# File 'lib/amiba/source/entry_finder.rb', line 105 def apply entry_files.map do |ef| _, category, filename = ef.split('/') name, format = filename.split('.') Amiba::Source::Entry.new(category, name, format) end end |
#entry_files ⇒ Object
112 113 114 115 |
# File 'lib/amiba/source/entry_finder.rb', line 112 def entry_files globstring = "entries/#{@category == :all ? '*' : @category.to_s}/*" Dir.glob(globstring).select {|e| !repo.log(e).empty?} end |