Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

simplified months translator

  • Loading branch information...
commit c3ce7b51d85f7a23ca5866c2c79c708d23c5e193 1 parent fab237b
Jeff Morgan authored
Showing with 10 additions and 5 deletions.
  1. +5 −4 lib/data_magic.rb
  2. +5 −1 lib/data_magic/translation.rb
9 lib/data_magic.rb
View
@@ -2,14 +2,11 @@
require 'data_magic/core_ext/fixnum'
require "data_magic/version"
require "data_magic/translation"
-require "data_magic/date_translation"
require 'yml_reader'
-
require 'faker'
module DataMagic
include Translation
- include DateTranslation
extend YmlReader
def self.included(cls)
@@ -30,12 +27,16 @@ def prep_data(data)
data.each do |key, value|
unless value.nil?
next unless value.respond_to? '[]'
- data[key] = eval(value[1..-1]) if value[0,1] == "~"
+ data[key] = translate(value[1..-1]) if value[0,1] == "~"
end
end
data
end
+ def translate(value)
+ eval(value)
+ end
+
class << self
attr_accessor :yml
6 lib/data_magic/translation.rb
View
@@ -1,5 +1,9 @@
+require 'data_magic/date_translation'
+
module DataMagic
module Translation
+ include DateTranslation
+
#
# return a random name (first and last)
#
@@ -244,7 +248,7 @@ def mask(value)
alias_method :dm_mask, :mask
def month
- randomize(%w[January February March April May June July August September October November December])
+ randomize(Date::MONTHNAMES[1..-1])
end
private
Please sign in to comment.
Something went wrong with that request. Please try again.