Class: DBRotator::Schema

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, schema_regex) ⇒ Schema

Returns a new instance of Schema.



165
166
167
168
# File 'lib/db_rotator.rb', line 165

def initialize(name, schema_regex)
  @name = name
  @schema_regex = schema_regex
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



163
164
165
# File 'lib/db_rotator.rb', line 163

def name
  @name
end

Instance Method Details

#to_dateObject



170
171
172
173
174
175
# File 'lib/db_rotator.rb', line 170

def to_date
  Date.strptime(
    name.match(@schema_regex)[1],
    TIME_FORMAT
  )
end