Class: Prekladatelj::Helper

Inherits:
Object
  • Object
show all
Defined in:
lib/prekladatelj.rb

Overview

class Preferences

  @preferences = {}

  # @param [Hash] prefs
  def self.define(prefs)
    @preferences = prefs if prefs.kind_of? Hash
  end

  def self.preferences=(prefs)
    define prefs
  end

  def self.preferences
    @preferences
  end

end

Class Method Summary collapse

Class Method Details

.smart_split(string) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/prekladatelj.rb', line 38

def self.smart_split(string)
  a = []
  last = ''
  (0..string.length-1).each do |l|
    if string[l]==' '
      a.append last unless last.empty?
      a.append string[l]
      last = ''
    else
      last = last + string[l]
    end
    a.append last if l==string.length-1
  end
  a
end