Sha256: 32991103ac46746e469eb28a22b8937fe2fbba65a7a4596509b27254f73312fb

Contents?: true

Size: 727 Bytes

Versions: 6

Compression:

Stored size: 727 Bytes

Contents

# encoding: utf-8

module Faker
  # Based on Perl's Text::Lorem
  module LoremAR
    extend ModuleUtils
    extend self

    def word
      WORDS.sample
    end

    def words(num = 3)
      WORDS.random_pick(num)
    end

    def sentence(word_count = 4)
      s = words(word_count + rand(6))
      s = s.join(' ')
      s.capitalize!
      "#{s}."
    end

    alias_method :phrase, :sentence

    def sentences(sentence_count = 3)
      (1..sentence_count).map { sentence }
    end

    alias_method :phrases, :sentences

    def paragraph(sentence_count = 3)
      sentences(sentence_count + rand(3)).join(' ')
    end

    def paragraphs(paragraph_count = 3)
      (1..paragraph_count).map { paragraph }
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/ffaker-1.32.1/lib/ffaker/lorem_ar.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/ffaker-1.32.1/lib/ffaker/lorem_ar.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/ffaker-1.32.1/lib/ffaker/lorem_ar.rb
ffaker-1.32.1 lib/ffaker/lorem_ar.rb
ffaker-1.32.0 lib/ffaker/lorem_ar.rb
ffaker-1.31.0 lib/ffaker/lorem_ar.rb