Module: Wrnap::Rna::Extensions

Included in:
Wrnap::Rna
Defined in:
lib/wrnap/rna/extensions.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods, OneStructureBasedMethods, TwoStructureBasedMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/wrnap/rna/extensions.rb', line 4

def self.included(base)
  base.send(:include, InstanceMethods)
  base.extend(ClassMethods)
  base.extend(OneStructureBasedMethods)
  base.extend(TwoStructureBasedMethods)
  base.class_eval do
    OneStructureBasedMethods.public_instance_methods.each do |class_method|
      define_method(class_method) do |*args|
        self.class.send(class_method, *[structure].concat(args))
      end
    end

    TwoStructureBasedMethods.public_instance_methods.each do |class_method|
      define_method(class_method) do |*args|
        self.class.send(class_method, *[str_1, str_2].concat(args))
      end
    end
  end

  base.send(:include, InstanceMethods)
end