Module: ViennaRna::RnaExtensions

Included in:
Rna
Defined in:
lib/vienna_rna/modules/rna_extensions.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods, StructureBasedClassAndInstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/vienna_rna/modules/rna_extensions.rb', line 3

def self.included(base)
  base.extend(ClassMethods)
  base.send(:include, InstanceMethods)
  base.extend(StructureBasedClassAndInstanceMethods)

  # All the methods in here are also copied in as instance methods, where the first argument is the ViennaRna::Rna#structure      
  base.class_eval do
    StructureBasedClassAndInstanceMethods.public_instance_methods.each do |class_method|
      define_method(class_method) do |*args|
        self.class.send(class_method, *[structure].concat(args))
      end
    end
  end
  
  base.send(:include, InstanceMethods)
end