Class: ParseSubstance
- Inherits:
-
Object
- Object
- ParseSubstance
- Defined in:
- lib/oddb2xml/parslet_compositions.rb
Instance Attribute Summary collapse
-
#cdose ⇒ Object
Returns the value of attribute cdose.
-
#chemical_qty ⇒ Object
Returns the value of attribute chemical_qty.
-
#chemical_substance ⇒ Object
Returns the value of attribute chemical_substance.
-
#chemical_unit ⇒ Object
Returns the value of attribute chemical_unit.
-
#description ⇒ Object
Returns the value of attribute description.
-
#dose ⇒ Object
Returns the value of attribute dose.
-
#is_active_agent ⇒ Object
Returns the value of attribute is_active_agent.
-
#is_excipiens ⇒ Object
Returns the value of attribute is_excipiens.
-
#more_info ⇒ Object
Returns the value of attribute more_info.
-
#name ⇒ Object
Returns the value of attribute name.
- #qty ⇒ Object
-
#salts ⇒ Object
Returns the value of attribute salts.
- #unit ⇒ Object
Instance Method Summary collapse
-
#initialize(name, dose = nil) ⇒ ParseSubstance
constructor
A new instance of ParseSubstance.
- #to_string ⇒ Object
Constructor Details
#initialize(name, dose = nil) ⇒ ParseSubstance
Returns a new instance of ParseSubstance.
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'lib/oddb2xml/parslet_compositions.rb', line 333 def initialize(name, dose = nil) puts "ParseSubstance.new from #{name.inspect} #{dose.inspect}" if VERBOSE_MESSAGES @name = ParseUtil.capitalize(name.to_s) @name.sub!(/\baqua\b/i, "aqua") @name.sub!(/\bDER\b/i, "DER") @name.sub!(/\bad pulverem\b/i, "ad pulverem") @name.sub!(/\bad iniectabilia\b/i, "ad iniectabilia") @name.sub!(/\bad suspensionem\b/i, "ad suspensionem") @name.sub!(/\bad solutionem\b/i, "ad solutionem") @name.sub!(/\bpro compresso\b/i, "pro compresso") @name.sub!(/\bpro\b/i, "pro") @name.sub!(/ Q\.S\. /i, " q.s. ") @name.sub!(/\s+\bpro$/i, "") @dose = dose if dose @salts = [] end |
Instance Attribute Details
#cdose ⇒ Object
Returns the value of attribute cdose.
330 331 332 |
# File 'lib/oddb2xml/parslet_compositions.rb', line 330 def cdose @cdose end |
#chemical_qty ⇒ Object
Returns the value of attribute chemical_qty.
330 331 332 |
# File 'lib/oddb2xml/parslet_compositions.rb', line 330 def chemical_qty @chemical_qty end |
#chemical_substance ⇒ Object
Returns the value of attribute chemical_substance.
330 331 332 |
# File 'lib/oddb2xml/parslet_compositions.rb', line 330 def chemical_substance @chemical_substance end |
#chemical_unit ⇒ Object
Returns the value of attribute chemical_unit.
330 331 332 |
# File 'lib/oddb2xml/parslet_compositions.rb', line 330 def chemical_unit @chemical_unit end |
#description ⇒ Object
Returns the value of attribute description.
331 332 333 |
# File 'lib/oddb2xml/parslet_compositions.rb', line 331 def description @description end |
#dose ⇒ Object
Returns the value of attribute dose.
330 331 332 |
# File 'lib/oddb2xml/parslet_compositions.rb', line 330 def dose @dose end |
#is_active_agent ⇒ Object
Returns the value of attribute is_active_agent.
330 331 332 |
# File 'lib/oddb2xml/parslet_compositions.rb', line 330 def is_active_agent @is_active_agent end |
#is_excipiens ⇒ Object
Returns the value of attribute is_excipiens.
330 331 332 |
# File 'lib/oddb2xml/parslet_compositions.rb', line 330 def is_excipiens @is_excipiens end |
#more_info ⇒ Object
Returns the value of attribute more_info.
331 332 333 |
# File 'lib/oddb2xml/parslet_compositions.rb', line 331 def more_info @more_info end |
#name ⇒ Object
Returns the value of attribute name.
330 331 332 |
# File 'lib/oddb2xml/parslet_compositions.rb', line 330 def name @name end |
#qty ⇒ Object
350 351 352 353 |
# File 'lib/oddb2xml/parslet_compositions.rb', line 350 def qty return @dose.qty_range if @dose&.qty_range @dose ? @dose.qty : @qty end |
#salts ⇒ Object
Returns the value of attribute salts.
331 332 333 |
# File 'lib/oddb2xml/parslet_compositions.rb', line 331 def salts @salts end |
#unit ⇒ Object
355 356 357 358 |
# File 'lib/oddb2xml/parslet_compositions.rb', line 355 def unit return @unit if @unit @dose ? @dose.unit : @unit end |
Instance Method Details
#to_string ⇒ Object
360 361 362 363 364 365 366 |
# File 'lib/oddb2xml/parslet_compositions.rb', line 360 def to_string s = "#{@name}:" s = " #{@qty}" if @qty s = " #{@unit}" if @unit s += @chemical_substance.to_s if chemical_substance s end |