Module: Bable

Defined in:
lib/bable.rb,
lib/bable/index.rb,
lib/bable/version.rb,
lib/bable/index/ari.rb,
lib/bable/index/base.rb,
lib/bable/statistic_string.rb,
lib/bable/index/coleman_liau.rb

Defined Under Namespace

Modules: Index Classes: StatisticString

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.index(text, index: :coleman_liau) ⇒ Babel::Index::Base

Instantiate a readability index calculator.

Parameters:

  • text (String)

    the text to analyse.

  • index (Symbol) (defaults to: :coleman_liau)

    the index to use (in underscore format).

Returns:

  • (Babel::Index::Base)

    the instantiated subclass of ‘Babel::Index::Base` according to the index.



17
18
19
# File 'lib/bable.rb', line 17

def index(text, index: :coleman_liau)
  Index.target_class(index).new(text)
end