Method: Ensembl::Core::Slice#method_missing
- Defined in:
- lib/bio-ensembl/core/slice.rb
#method_missing(method_name, *args) ⇒ Object
– As there should be ‘getters’ for a lot of classes, we’ll implement this with method_missing. For some of the original methods, see the end of this file.
The optional argument is either ‘true’ or ‘false’ (default = false). False if the features have to be completely contained within the slice; true if just a partly overlap is sufficient. ++ Don’t use this method yourself.
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 |
# File 'lib/bio-ensembl/core/slice.rb', line 411 def method_missing(method_name, *args) table_name = method_name.to_s.singularize class_name = table_name.camelcase # Convert to the class object target_class = nil ObjectSpace.each_object(Class) do |o| if o.name =~ /^Ensembl::Core::#{class_name}$/ target_class = o end end # If it exists, see if it implements Sliceable if ! target_class.nil? and target_class.include?(Sliceable) inclusive = false if [TrueClass, FalseClass].include?(args[0].class) inclusive = args[0] end return self.get_objects(target_class, table_name, inclusive) end raise NoMethodError end |