Class: Mactag::Indexer::Rails

Inherits:
Object
  • Object
show all
Defined in:
lib/mactag/indexer/rails.rb

Constant Summary collapse

PACKAGES =
%w(actionmailer actionpack activemodel activerecord activeresource activesupport railties)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Rails

Returns a new instance of Rails.



9
10
11
12
13
# File 'lib/mactag/indexer/rails.rb', line 9

def initialize(options)
  @only = packagize(options[:only])
  @except = packagize(options[:except])
  @version = options[:version]
end

Instance Attribute Details

#exceptObject

Returns the value of attribute except.



7
8
9
# File 'lib/mactag/indexer/rails.rb', line 7

def except
  @except
end

#onlyObject

Returns the value of attribute only.



7
8
9
# File 'lib/mactag/indexer/rails.rb', line 7

def only
  @only
end

#versionObject

Returns the value of attribute version.



7
8
9
# File 'lib/mactag/indexer/rails.rb', line 7

def version
  @version
end

Instance Method Details

#packagesObject



22
23
24
25
26
27
28
# File 'lib/mactag/indexer/rails.rb', line 22

def packages
  if only || except
    only || PACKAGES - except
  else
    PACKAGES
  end
end

#tagObject



15
16
17
18
19
20
# File 'lib/mactag/indexer/rails.rb', line 15

def tag
  packages.inject([]) do |array, package|
    array << Gem.new(package, version).tag
    array
  end
end