Module: Distribution::Shorthand

Defined in:
lib/distribution/shorthand.rb

Constant Summary collapse

EQUIVALENCES =
{ p_value: :p, cdf: :cdf, pdf: :pdf, rng: :r,
exact_pdf: :epdf, exact_cdf: :ecdf, exact_p_value: :ep }

Class Method Summary collapse

Class Method Details

.add_shortcut(shortcut, method, &block) ⇒ Object


6
7
8
9
10
11
12
13
14
15
# File 'lib/distribution/shorthand.rb', line 6

def self.add_shortcut(shortcut, method, &block)
  if EQUIVALENCES.include? method.to_sym
    name = shortcut + "_#{method}"
    define_method(name, &block)

    name = shortcut + "_#{EQUIVALENCES[method.to_sym]}"
    define_method(name, &block)

  end
end