Class: OpenNlp::Util::Span
- Inherits:
-
Object
- Object
- OpenNlp::Util::Span
- Includes:
- JavaClass
- Defined in:
- lib/open_nlp/util/span.rb
Instance Attribute Summary collapse
-
#j_instance ⇒ Object
readonly
Returns the value of attribute j_instance.
Instance Method Summary collapse
- #==(obj) ⇒ Object
- #end ⇒ Object
-
#initialize(s, e) ⇒ Span
constructor
A new instance of Span.
- #length ⇒ Object
- #start ⇒ Object
- #type ⇒ Object
Methods included from JavaClass
Constructor Details
#initialize(s, e) ⇒ Span
Returns a new instance of Span.
8 9 10 11 12 13 |
# File 'lib/open_nlp/util/span.rb', line 8 def initialize(s, e) fail ArgumentError, 's should be an integer' unless s.is_a?(Fixnum) fail ArgumentError, 'e should be an integer' unless e.is_a?(Fixnum) @j_instance = self.class.java_class.new(s, e) end |
Instance Attribute Details
#j_instance ⇒ Object (readonly)
Returns the value of attribute j_instance.
6 7 8 |
# File 'lib/open_nlp/util/span.rb', line 6 def j_instance @j_instance end |
Instance Method Details
#==(obj) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/open_nlp/util/span.rb', line 31 def ==(obj) return false unless obj.is_a?(self.class) [:start, :end, :type].each_with_object(true) do |method, acc| acc = acc && self.public_send(method) == obj.public_send(method) end end |
#end ⇒ Object
19 20 21 |
# File 'lib/open_nlp/util/span.rb', line 19 def end j_instance.getEnd end |
#length ⇒ Object
27 28 29 |
# File 'lib/open_nlp/util/span.rb', line 27 def length j_instance.length end |
#start ⇒ Object
15 16 17 |
# File 'lib/open_nlp/util/span.rb', line 15 def start j_instance.getStart end |
#type ⇒ Object
23 24 25 |
# File 'lib/open_nlp/util/span.rb', line 23 def type j_instance.getType end |