Class: Sem4r::TKeywordAttribute

Inherits:
Object
  • Object
show all
Includes:
Sem4rSoap::SoapAttributes
Defined in:
lib/sem4r/targeting_idea/targeting_idea.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Sem4rSoap::SoapAttributes

#_from_element, #_to_s, #_to_xml, included

Constructor Details

#initialize(&block) ⇒ TKeywordAttribute

Returns a new instance of TKeywordAttribute.



91
92
93
94
95
# File 'lib/sem4r/targeting_idea/targeting_idea.rb', line 91

def initialize(&block)
  if block_given?
    block.arity < 1 ? instance_eval(&block) : block.call(self)
  end
end

Class Method Details

.from_element(el) ⇒ Object



97
98
99
100
101
102
103
# File 'lib/sem4r/targeting_idea/targeting_idea.rb', line 97

def self.from_element( el )
  el1 = el.at_xpath("value")
  new do
    text       el1.at_xpath("text").text
    match_type el1.at_xpath("matchType").text
  end
end

Instance Method Details

#to_sObject



105
106
107
# File 'lib/sem4r/targeting_idea/targeting_idea.rb', line 105

def to_s
  "Keyword '#{text}' '#{match_type}'"
end