summaryrefslogtreecommitdiff
path: root/lib/feature.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/feature.rb')
-rw-r--r--lib/feature.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/feature.rb b/lib/feature.rb
index 0ca4d41..f811aef 100644
--- a/lib/feature.rb
+++ b/lib/feature.rb
@@ -8,10 +8,14 @@ module OpenTox
field :unit, type: String
field :conditions, type: Hash
+ # Is it a nominal feature
+ # @return [TrueClass,FalseClass]
def nominal?
self.class == NominalFeature
end
+ # Is it a numeric feature
+ # @return [TrueClass,FalseClass]
def numeric?
self.class == NumericFeature
end
@@ -30,6 +34,9 @@ module OpenTox
class Smarts < NominalFeature
field :smarts, type: String
index "smarts" => 1
+ # Create feature from SMARTS string
+ # @param [String]
+ # @return [OpenTox::Feature]
def self.from_smarts smarts
self.find_or_create_by :smarts => smarts
end