Class: Wrnap::Rna::Metadata::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/wrnap/rna/metadata.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rna) ⇒ Container

Returns a new instance of Container.



27
28
29
# File 'lib/wrnap/rna/metadata.rb', line 27

def initialize(rna)
  @__rna__, @__data__ = rna, {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



37
38
39
40
41
42
# File 'lib/wrnap/rna/metadata.rb', line 37

def method_missing(name, *args, &block)
  case args.size
  when 0 then __data__[name]
  when 1 then __data__[name.to_s.gsub(/=$/, "").to_sym] = args.first
  else super end
end

Instance Attribute Details

#__data__Object (readonly)

Returns the value of attribute __data__.



25
26
27
# File 'lib/wrnap/rna/metadata.rb', line 25

def __data__
  @__data__
end

#__rna__Object (readonly)

Returns the value of attribute __rna__.



25
26
27
# File 'lib/wrnap/rna/metadata.rb', line 25

def __rna__
  @__rna__
end

Instance Method Details

#inspectObject Also known as: to_s



31
32
33
# File 'lib/wrnap/rna/metadata.rb', line 31

def inspect
  "#<Metadata: %s>" % __data__.inspect
end