Sha256: 001d4c73221449a683f04a6220117a18c1425569419e4ab684611d05fb592cde

Contents?: true

Size: 590 Bytes

Versions: 2

Compression:

Stored size: 590 Bytes

Contents

module LanguageCards
  module Helpers
    module ViewHelper
      def divider
        '~' * SUBMENUWIDTH
      end

      def t str
        I18n.t str
      end

      def draw left=nil, center=nil, right=nil
        width = SUBMENUWIDTH
        str = left.to_s
        str = str + center.to_s.rjust(width/2 - str.length + center.to_s.length/2)
        str + right.to_s.rjust(width - str.length)
      end

      def clear
        printf ::LanguageCards::ESC::CLEAR
      end

      def humanize string
        "#{string}".split('_').map(&:capitalize).join(' ')
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
language_cards-0.3.0 lib/language_cards/helpers/view_helper.rb
language_cards-0.2.0 lib/language_cards/helpers/view_helper.rb