Sha256: 75645ab12776fe38cf950def3cd82783645bd01e774531caff2a2e3ea1c6b0da
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
require 'faker' module Omelettes class Column attr_accessor :name, :style, :custom_block def initialize(name, style=nil, &block) @name = name @style = style @custom_block = block end def process(string) if @custom_block return @custom_block.call(string) else Column.default(@style || @name, string) end end def self.default(name, value) name = name.downcase.to_sym case name when :hardened return value when :first_name, :last_name return Faker::Name.send(name) when :city, :state, :country, :street_address, :street_name, :zip_code return Faker::Address.send(name) when :company_name, :company return Faker::Company.name when :email, :user_name return Faker::Internet.send(name) when :paragraph, :paragraphs, :sentence, :sentences, :words return Faker::Lorem.send(name) when :phone, :contact_phone, :fax return Faker::PhoneNumber.phone_number when :url, :website return Faker::Internet.domain_name else return Omelettes::Obfuscate.obfuscate(value) end end def as(style) @style = style unless @style == :hardened self end alias :like :as end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
omelettes-0.5.1 | lib/omelettes/column.rb |
omelettes-0.5.0 | lib/omelettes/column.rb |