Class: Germinate::Variable

Inherits:
String
  • Object
show all
Defined in:
lib/germinate/variable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value, line, source_path, line_number) ⇒ Variable

Returns a new instance of Variable.



6
7
8
9
10
11
# File 'lib/germinate/variable.rb', line 6

def initialize(name, value, line, source_path, line_number)
  super(value.to_s)
  @name = name
  @line = line
  @origin = Germinate::Origin.new(source_path, line_number)
end

Instance Attribute Details

#lineObject (readonly)

Returns the value of attribute line.



4
5
6
# File 'lib/germinate/variable.rb', line 4

def line
  @line
end

#nameObject (readonly)

Returns the value of attribute name.



2
3
4
# File 'lib/germinate/variable.rb', line 2

def name
  @name
end

#originObject (readonly)

Returns the value of attribute origin.



3
4
5
# File 'lib/germinate/variable.rb', line 3

def origin
  @origin
end

Instance Method Details

#update_source_line!(comment_prefix) ⇒ Object



13
14
15
# File 'lib/germinate/variable.rb', line 13

def update_source_line!(comment_prefix)
  line.replace(make_control_line(comment_prefix))
end