Skip to content

bchase/cloze

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cloze

A Ruby cloze deletion module

GitHub: bchase/cloze

Installation

Add this line to your application's Gemfile:

gem 'cloze', :git => 'git://github.com/bchase/cloze.git'

And then execute:

$ bundle

Usage

Simply include Cloze::Deletion in String or a String subclass

class String
  include Cloze::Deletion
end

and then use the .cloze_delete instance method to perform cloze deletions

"foo".cloze_delete(:each) 
# => ['#oo','f#o','fo#']

"foo".cloze_delete(:each, :all) 
# => ['#oo','f#o','fo#','###']

"巻き込む".cloze_delete(:kanji) 
# => ['#き込む','巻き#む']


# using a different cloze deletion character...

"foo".cloze_delete(:each, with: '?')
# => ['?oo','f?o','fo?']

.cloze_delete will default to :each if no arguments are supplied

"foo".cloze_delete
# => ['#oo','f#o','fo#']

and it can also be used simply as .cloze

"foo".cloze
# => ['#oo','f#o','fo#']

It's also possible to permanently change the cloze deletion character:

Cloze::Deletion.default_deletion_character = '?'

"foo".cloze_delete(:each)
# => ['?oo','f?o','fo?']

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Write specs
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

About

A Ruby cloze deletion module

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages