Class: Conpar::Directive::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/conpar/directive/base.rb

Overview

Base class for all Directives

Direct Known Subclasses

AccessList::Base, Comment, Empty

Constant Summary collapse

SIGNATURE =

Matches any non-empty string

/^(.*)$/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content = "", options = {}) ⇒ Base


43
44
45
46
47
48
49
50
# File 'lib/conpar/directive/base.rb', line 43

def initialize(content="", options={})
  @line_number = options[:line_number]
  @line_span = options.fetch(:line_span, 1)
  @content = content.to_s.strip
  @ilk = :directive
  @sub_ilk = ""
  self
end

Instance Attribute Details

#contentString (readonly)


21
22
23
# File 'lib/conpar/directive/base.rb', line 21

def content
  @content
end

#ilkSymbol (readonly)


26
27
28
# File 'lib/conpar/directive/base.rb', line 26

def ilk
  @ilk
end

#line_numberString


11
12
13
# File 'lib/conpar/directive/base.rb', line 11

def line_number
  @line_number
end

#line_spanInteger


16
17
18
# File 'lib/conpar/directive/base.rb', line 16

def line_span
  @line_span
end

#match_dataMatchData (readonly)


36
37
38
# File 'lib/conpar/directive/base.rb', line 36

def match_data
  @match_data
end

#ruleString (readonly)


40
41
42
# File 'lib/conpar/directive/base.rb', line 40

def rule
  @rule
end

#sub_ilkString (readonly)


31
32
33
# File 'lib/conpar/directive/base.rb', line 31

def sub_ilk
  @sub_ilk
end