Module: EveStatic::Queries::Industry::ClassMethods

Defined in:
lib/eve_static/queries/industry.rb

Instance Method Summary collapse

Instance Method Details

#industry_time_generator(method, defaults = {}, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/eve_static/queries/industry.rb', line 5

def industry_time_generator(method, defaults = {}, &block)
  if !block_given?
    raise 'you need to supply a block to industry_time_generator'
  end

  define_method method do |type, opt = {}|
    params = defaults.merge(opt)
    typeID = coerce_industry_type(type)
  
    result = instance[:invBlueprintTypes].where(:blueprintTypeID => typeID).first
  
    block.call(result, params)
  end
end

#research_time(base, skill, slot, implant) ⇒ Object



20
21
22
# File 'lib/eve_static/queries/industry.rb', line 20

def research_time(base, skill, slot, implant)
  base * (1 - (0.05 * skill)) * slot * implant
end