Sha256: 24a3637189befe6ce7bb1d4868eb86c93f7bc2a9ed29daeb3df824e9fde24324

Contents?: true

Size: 466 Bytes

Versions: 4

Compression:

Stored size: 466 Bytes

Contents

# encoding: utf-8

module TrangeFrange
  class Shaper < Struct.new :words, :fraction, :options
    OPTIONS = [:bald, :squeeze, :show_fraction]

    def shape!
      OPTIONS.each { |option| send(option) if options[option] } and return words
    end

    private

      def show_fraction
        words << " i #{fraction}/100"
      end

      def squeeze
        words.delete!(' ')
      end

      def bald
        words.tr!('čćšđž', 'ccsdz')
      end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trange_frange-0.1.5 lib/trange_frange/shaper.rb
trange_frange-0.1.4 lib/trange_frange/shaper.rb
trange_frange-0.1.3 lib/trange_frange/shaper.rb
trange_frange-0.1.2 lib/trange_frange/shaper.rb