module Lebowski::Foundation::Util

Public Class Methods

get_root_application_object(proxy) click to toggle source
# File lib/lebowski/foundation/core.rb, line 63
def self.get_root_application_object(proxy)
  if proxy.nil?
    raise ArgumentInvalidTypeError.new "proxy", proxy, Lebowski::Foundation::ProxyObject
  end
  
  current_proxy = proxy
  while not current_proxy.nil? do
    return current_proxy if current_proxy.kind_of?(Lebowski::Foundation::Application)
    current_proxy = current_proxy.parent
  end
  
  return nil
end
to_camel_case(value) click to toggle source

Will return a string in camel case format for any value that follows the Ruby variable and method naming convention (e.g. my_variable_name). As an example:

Util.to_camel_case(:some_long_name) # => "someLongName"
Util.to_camel_case("function_foo_bar") # => "functionFooBar"
# File lib/lebowski/foundation/core.rb, line 88
def self.to_camel_case(value)
  camel_case_str = ""
  word_counter = 1
  words = value.to_s.split('_')
  return words[0] if words.length == 1
  words.each do |word|
    camel_case_str << ((word_counter == 1) ? word : word.sub(/./) { |s| s.upcase })   
    word_counter = word_counter.next
  end
  return camel_case_str
end

Public Instance Methods

assert_is_object(value, name) click to toggle source
# File lib/lebowski/foundation/core.rb, line 51
def assert_is_object(value, name) 
  if not value.kind_of? Lebowski::Foundation::ProxyObject
    raise ArgumentInvalidTypeError.new name, value, Lebowski::Foundation::ProxyObject
  end
end
assert_is_view(value, name) click to toggle source
# File lib/lebowski/foundation/core.rb, line 57
def assert_is_view(value, name)
  if not value.kind_of? Lebowski::Foundation::Views::View
    raise ArgumentInvalidTypeError.new name, value, Lebowski::Foundation::Views::View
  end
end
get_root_application_object() click to toggle source
# File lib/lebowski/foundation/core.rb, line 77
def get_root_application_object()
  return Util.get_root_application_object(self)
end