Skip to content

Instantly share code, notes, and snippets.

@nakao
Created October 23, 2010 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nakao/641871 to your computer and use it in GitHub Desktop.
Save nakao/641871 to your computer and use it in GitHub Desktop.
require 'bio'
class Bio::Sequence::NA
def self.compute_melting_temperature(nastr)
10 # code here ...
end
def melting_temperature
if @melting_temperature
@melting_temperature
else
@melting_temperature = self.class.compute_melting_temperature(self)
end
end
end
if __FILE__ == $0
# as a class method (static method ?)
p Bio::Sequence::NA.compute_melting_temperature("ACGT")
# as an instance method
na = Bio::Sequence::NA.new("ACGT")
p na.melting_temperature
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment