Sha256: 00d153dacf51c56a051af34961c3915cfc1660a2d55233e27e3c26401bca8d54

Contents?: true

Size: 914 Bytes

Versions: 2

Compression:

Stored size: 914 Bytes

Contents

module Mockumentary
  module Data
    def self.generate(key)
      self.send(key) if key.is_a?(Symbol) && respond_to?(key) 
    end

    def self.string
      Faker::Lorem.words.join(' ')
    end

    def self.text
      Faker::Lorem.sentences.join(' ')
    end

    def self.integer
      rand(100)
    end

    def self.decimal
      rand * 100
    end

    def self.float
      decimal
    end

    def self.time
      Time.now + rand(60) * (3600*24)
    end

    def self.timestamp
      time
    end

    def self.datetime
      time
    end

    def self.date
      Date.today + rand(60) * (3600*24)
    end

    def self.binary
      Faker::Lorem.characters
    end

    def self.boolean
      false
    end

    def self.first_name
      Faker::Name.first_name
    end

    def self.last_name
      Faker::Name.last_name
    end

    def self.full_name
      "#{first_name} #{last_name}"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mockumentary-0.2.1 lib/mockumentary/data.rb
mockumentary-0.2.0 lib/mockumentary/data.rb