Sha256: b635b901e57e925716d3d0a982c12a7207aab384b079550cad3aca697d2be82c

Contents?: true

Size: 574 Bytes

Versions: 2

Compression:

Stored size: 574 Bytes

Contents

require 'facemock/database/table'
require 'facemock/user'

module Facemock
  class Application < Database::Table
    TABLE_NAME = :applications
    COLUMN_NAMES = [:id, :secret, :created_at]
    CHILDREN = [ User ]

    # WANT : DBに登録済みの値と重複しないようにする(id, secret)
    def initialize(options={})
      opts = Hashie::Mash.new(options)
      @id         = ( opts.id.to_i > 0 ) ? opts.id.to_i : (0..9).to_a.shuffle[0..15].join.to_i
      @secret     = opts.secret || rand(36**32).to_s(36)
      @created_at = opts.created_at
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
facemock-0.0.9 lib/facemock/application.rb
facemock-0.0.8 lib/facemock/application.rb