Module: YBoss
- Defined in:
- lib/yboss.rb,
lib/yboss/web.rb,
lib/yboss/base.rb,
lib/yboss/news.rb,
lib/yboss/blogs.rb,
lib/yboss/oauth.rb,
lib/yboss/config.rb,
lib/yboss/images.rb,
lib/yboss/related.rb,
lib/yboss/spelling.rb,
lib/yboss/limitedweb.rb,
lib/yboss/result/base.rb,
lib/yboss/result/item.rb
Defined Under Namespace
Modules: Result
Classes: ArgumentException, Base, Blogs, Config, FetchError, Images, Limitedweb, News, Oauth, Related, Spelling, Web
Constant Summary
collapse
- SERVICE_PREFIX =
'http://yboss.yahooapis.com/ysearch/'
Class Method Summary
collapse
Class Method Details
.class_from_string(str) ⇒ Object
17
18
19
20
21
|
# File 'lib/yboss.rb', line 17
def self.class_from_string(str)
str.split('::').inject(Object) do |mod, class_name|
mod.const_get(class_name)
end
end
|
.config ⇒ Object
9
10
11
12
13
14
|
# File 'lib/yboss/config.rb', line 9
def self.config
if block_given?
yield Config.instance
end
Config.instance
end
|
.method_missing(sym, *args, &block) ⇒ Object
7
8
9
10
11
12
13
14
|
# File 'lib/yboss.rb', line 7
def self.method_missing(sym, *args, &block)
clazz_name = 'YBoss::' + sym.to_s.split(/_/).map { |w| w[0].upcase + w[1..w.length] }.join('::')
lib_name = 'yboss/' + sym.to_s.gsub(/_/, '/')
require lib_name
clazz = class_from_string(clazz_name)
return clazz.new(args[0]).call
end
|