Class: Gemgate::SpecsIndex

Inherits:
Object
  • Object
show all
Defined in:
lib/gemgate/specs_index.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ SpecsIndex

Returns a new instance of SpecsIndex.



6
7
8
9
# File 'lib/gemgate/specs_index.rb', line 6

def initialize(filename)
  @filename = filename
  @conditions = []
end

Instance Attribute Details

#conditionsObject (readonly)

Returns the value of attribute conditions.



4
5
6
# File 'lib/gemgate/specs_index.rb', line 4

def conditions
  @conditions
end

#storageObject

Returns the value of attribute storage.



3
4
5
# File 'lib/gemgate/specs_index.rb', line 3

def storage
  @storage
end

Instance Method Details

#add(gem) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/gemgate/specs_index.rb', line 11

def add(gem)
  if conditions.all? {|c| c.call(gem) }
    update_with(gem)
  else
    ensure_exists
  end
end