Module: Ua::Util

Defined in:
lib/ua/util.rb

Defined Under Namespace

Classes: AppHelper, Helper

Instance Method Summary collapse

Instance Method Details

#istr(str) ⇒ Object



74
75
76
77
# File 'lib/ua/util.rb', line 74

def istr(str)
  first = str[/^\s*(\S)/, 1]
  str.split("\n").map{|x| x.sub(/^\s*#{Regexp.escape(first)}/, "")}.join("\n")
end

#ua(obj_or_str) ⇒ Object

Raises:

  • (ArgumentError)


40
41
42
43
44
45
46
47
# File 'lib/ua/util.rb', line 40

def ua(obj_or_str)
	if Ua::Application::UAClass === obj_or_str
		return Helper.new(obj_or_str)
	elsif String === obj_or_str
		return Helper.new(Ua::Application.top_app.get(obj_or_str))
	end
	raise ArgumentError, "Don't know how to make ua from #{obj_or_str}", caller(3)
end

#uapp(app = Ua::Application.top_app) ⇒ Object



70
71
72
# File 'lib/ua/util.rb', line 70

def uapp(app = Ua::Application.top_app)
	AppHelper.new(app)
end