Class: Zemanta::Markup::Link

Inherits:
Object
  • Object
show all
Defined in:
lib/zemanta/markup/link.rb,
lib/zemanta/markup/link/target.rb

Defined Under Namespace

Classes: Target

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Link

Returns a new instance of Link.



6
7
8
9
10
11
12
# File 'lib/zemanta/markup/link.rb', line 6

def initialize(opts = {})
  @relevance   = opts["relevance"]
  @confidence  = opts["confidence"]
  @entity_type = opts["entity_type"]
  @target      = opts["target"].map{ |opts| Target.new(opts) }
  @anchor      = opts["anchor"]
end

Instance Attribute Details

#anchorObject (readonly)

Returns the value of attribute anchor.



4
5
6
# File 'lib/zemanta/markup/link.rb', line 4

def anchor
  @anchor
end

#confidenceObject (readonly)

Returns the value of attribute confidence.



4
5
6
# File 'lib/zemanta/markup/link.rb', line 4

def confidence
  @confidence
end

#entity_typeObject (readonly)

Returns the value of attribute entity_type.



4
5
6
# File 'lib/zemanta/markup/link.rb', line 4

def entity_type
  @entity_type
end

#relevanceObject (readonly)

Returns the value of attribute relevance.



4
5
6
# File 'lib/zemanta/markup/link.rb', line 4

def relevance
  @relevance
end

#targetObject (readonly)

Returns the value of attribute target.



4
5
6
# File 'lib/zemanta/markup/link.rb', line 4

def target
  @target
end

Instance Method Details

#above?(relevance, confidence) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/zemanta/markup/link.rb', line 14

def above?(relevance, confidence)
  @relevance >= relevance and @confidence >= confidence
end