Class: Rubabel::Smarts

Inherits:
Object show all
Defined in:
lib/rubabel/smarts.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ Smarts

Returns a new instance of Smarts.



8
9
10
11
12
13
14
# File 'lib/rubabel/smarts.rb', line 8

def initialize(string)
  @string = string
  @ob = OpenBabel::OBSmartsPattern.new
  unless @ob.init(string)
    raise ArgumentError, "#{string} not a valid SMARTS string"
  end
end

Instance Attribute Details

#obObject

Returns the value of attribute ob.



6
7
8
# File 'lib/rubabel/smarts.rb', line 6

def ob
  @ob
end

Instance Method Details

#inspectObject



23
24
25
# File 'lib/rubabel/smarts.rb', line 23

def inspect
  "<Rubabel::Smarts #{to_s}>"
end

#to_sObject



16
17
18
19
20
21
# File 'lib/rubabel/smarts.rb', line 16

def to_s
  # would like to do the above, but just getting this:
  # #<SWIG::TYPE_p_std__string:0x000000022ecd70
  # @obsmarts.get_smarts.to_s
  @string
end