public
Description: A ruby client for freebase
Clone URL: git://github.com/dustin/ruby-freebase.git
chriseppstein (author)
Sun Feb 03 12:15:22 -0800 2008
commit  a631c2035df055d70560a7a7a248a146cc1ee69f
tree    1dba0c62d357e1b0a8e15588fc2f3dd531c055f3
parent  70ce157b1061accaa86c21b5694dd592dec21ac5
ruby-freebase / lib / core_extensions.rb
100644 17 lines (14 sloc) 0.517 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Need to modify the inbuilt Module class, to catch const_missing calls.
class Module
 
  # New version of const_missing which catches requests made to the
  # Metaweb module/namespace - and generates modules to represent
  # data domains if necessary.
  def const_missing_with_freebase_support(class_id)
    if self.name[/^Freebase::Types/]
      new_freebase_type(class_id)
    else
      const_missing_without_freebase_support(class_id)
    end
  end
  
  alias_method_chain :const_missing, :freebase_support
  
end