Class: Decode::Syntax::Link

Inherits:
Match
  • Object
show all
Defined in:
lib/decode/syntax/link.rb

Instance Attribute Summary collapse

Attributes inherited from Match

#range

Instance Method Summary collapse

Methods inherited from Match

#<=>, #offset, #size

Constructor Details

#initialize(range, definition) ⇒ Link

Returns a new instance of Link.



11
12
13
14
15
# File 'lib/decode/syntax/link.rb', line 11

def initialize(range, definition)
	@definition = definition
	
	super(range)
end

Instance Attribute Details

#definitionObject (readonly)

Returns the value of attribute definition.



17
18
19
# File 'lib/decode/syntax/link.rb', line 17

def definition
  @definition
end

Instance Method Details

#apply(output, rewriter) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/decode/syntax/link.rb', line 19

def apply(output, rewriter)
	output << rewriter.link_to(
		@definition,
		rewriter.text_for(@range)
	)
	
	return self.size
end