Class: Forgery

Inherits:
Object
  • Object
show all
Defined in:
lib/forgery/extend.rb,
lib/forgery/forgery.rb,
lib/forgery/formats.rb,
lib/forgery/version.rb,
lib/forgery/file_reader.rb,
lib/forgery/dictionaries.rb,
lib/forgery/extensions/array.rb,
lib/forgery/extensions/range.rb,
lib/forgery/extensions/string.rb

Defined Under Namespace

Modules: Extensions Classes: Address, Basic, CreditCard, Currency, Date, Dictionaries, Email, FileReader, Formats, Geo, Internet, LoremIpsum, Monetary, Name, Personal, RussianTax, Time

Constant Summary

VERSION =
"0.5.0"

Class Method Summary (collapse)

Class Method Details

+ (Object) dictionaries



3
4
5
# File 'lib/forgery/forgery.rb', line 3

def self.dictionaries
  @@dictionaries ||= Dictionaries.new
end

+ (Object) Extend(object)



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/forgery/extend.rb', line 2

def self.Extend(object)
  case object
  when Array
    Forgery::Extensions::Array.new(object)
  when Range
    Forgery::Extensions::Range.new(object.first, object.last, object.exclude_end?)
  when String
    Forgery::Extensions::String.new(object)
  else
    object
  end
end

+ (Object) formats



7
8
9
# File 'lib/forgery/forgery.rb', line 7

def self.formats
  @@formats ||= Formats.new
end

+ (Object) load_from!(path)



15
16
17
18
# File 'lib/forgery/forgery.rb', line 15

def self.load_from!(path)
  self.load_paths << File.expand_path(path)
  Dir["#{self.load_paths.last}/**/*.rb"].uniq.each { |file| require file }
end

+ (Object) load_paths



11
12
13
# File 'lib/forgery/forgery.rb', line 11

def self.load_paths
  @@load_paths ||= [File.dirname(__FILE__)]
end

+ (Boolean) rails?

Returns:

  • (Boolean)


28
29
30
# File 'lib/forgery/forgery.rb', line 28

def self.rails?
  !rails_root.nil?
end

+ (Object) rails_root



20
21
22
23
24
25
26
# File 'lib/forgery/forgery.rb', line 20

def self.rails_root
  if defined?(Rails) && Rails.respond_to?(:root)
    Rails.root.to_s
  elsif defined?(RAILS_ROOT)
    RAILS_ROOT
  end
end