class ConfDb::Model::Prop

Public Class Methods

create_from_fixture!( name, path ) click to toggle source
todo/fix: move create_from_fixture! method to textutils ??? - why? why not?

yes - move to textutils! - fixture concept/notion is part of textutils

# File lib/props/activerecord/models.rb, line 12
def self.create_from_fixture!( name, path )
  key   = "db.#{fixture_name_to_prop_key(name)}.version"
  
  value = "txt.#{File.mtime(path).strftime('%Y.%m.%d')}"
  
  Prop.create!( key: key, value: value )
end

Private Class Methods

fixture_name_to_prop_key( name ) click to toggle source

helper

change at/2012_13/bl           to at.2012/13.bl
 or    quali_2012_13_europe_c  to quali.2012/13.europe.c
# File lib/props/activerecord/models.rb, line 32
def self.fixture_name_to_prop_key( name )
  prop_key = name.gsub( '/', '.' )
  prop_key = prop_key.gsub( /(\d{4})_(\d{2})/, '\1/\2' )  # 2012_13 => 2012/13
  prop_key = prop_key.gsub( '_', '.' )
  prop_key
end