Module: Hystorical

Defined in:
lib/hystorical.rb,
lib/hystorical/version.rb,
lib/hystorical/ar_relation.rb,
lib/hystorical/ruby_collection.rb,
lib/generators/hystorical/dates_generator.rb

Defined Under Namespace

Classes: ARRelation, DatesGenerator, RubyCollection

Constant Summary collapse

VERSION =
"1.0.0"

Class Method Summary collapse

Class Method Details

.current(collection) ⇒ Object



13
14
15
# File 'lib/hystorical.rb', line 13

def self.current(collection)
  delegate_class(collection).current(collection)
end

.current_on(collection, date) ⇒ Object



17
18
19
# File 'lib/hystorical.rb', line 17

def self.current_on(collection, date)
  delegate_class(collection).current_on(collection, date)
end

.delegate_class(collection) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/hystorical.rb', line 5

def self.delegate_class(collection)
  if collection.class == ActiveRecord::Relation
    return Hystorical::ARRelation
  else
    return Hystorical::RubyCollection
  end
end