Class: Fig::Statement
- Inherits:
-
Object
- Object
- Fig::Statement
- Defined in:
- lib/fig/statement.rb,
lib/fig/statement/asset.rb
Overview
A statement within a package definition file (package.fig).
Direct Known Subclasses
Archive, Command, Configuration, Include, Override, Path, Resource, Retrieve, Set
Defined Under Namespace
Modules: Asset Classes: Archive, Command, Configuration, Include, Override, Path, Resource, Retrieve, Set
Constant Summary collapse
- ENVIRONMENT_VARIABLE_NAME_REGEX =
%r< \A \w+ \z >x
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#source_description ⇒ Object
readonly
Returns the value of attribute source_description.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(line_column, source_description) ⇒ Statement
constructor
This mess of getting these as a single array necessary is due to limitations of the “*” array splat operator in ruby v1.8.
- #is_asset? ⇒ Boolean
-
#position_string ⇒ Object
Returns a representation of the position of this statement, if the position is known, empty string otherwise.
- #urls ⇒ Object
-
#walk_statements(&block) ⇒ Object
Block will receive a Statement.
Constructor Details
#initialize(line_column, source_description) ⇒ Statement
This mess of getting these as a single array necessary is due to limitations of the “*” array splat operator in ruby v1.8.
27 28 29 30 31 32 33 |
# File 'lib/fig/statement.rb', line 27 def initialize(line_column, source_description) if line_column @line, @column = *line_column end @source_description = source_description end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
7 8 9 |
# File 'lib/fig/statement.rb', line 7 def column @column end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
7 8 9 |
# File 'lib/fig/statement.rb', line 7 def line @line end |
#source_description ⇒ Object (readonly)
Returns the value of attribute source_description.
7 8 9 |
# File 'lib/fig/statement.rb', line 7 def source_description @source_description end |
Class Method Details
.position_description(line, column, source_description) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fig/statement.rb', line 9 def self.position_description(line, column, source_description) if not line or not column return '' if not source_description return " (#{source_description})" end description = " (line #{line}, column #{column}" if source_description description << ", #{source_description}" end description << ')' return description end |
Instance Method Details
#is_asset? ⇒ Boolean
44 45 46 |
# File 'lib/fig/statement.rb', line 44 def is_asset?() return false end |
#position_string ⇒ Object
Returns a representation of the position of this statement, if the position is known, empty string otherwise. This is written with the idea that you can do something like “puts %Q<Found a statement%Fig::Statement.statementstatement.position_string().>” and get nice looking output regardless of whether the position is actually known or not.
53 54 55 56 57 |
# File 'lib/fig/statement.rb', line 53 def position_string return Fig::Statement.position_description( @line, @column, @source_description ) end |
#urls ⇒ Object
40 41 42 |
# File 'lib/fig/statement.rb', line 40 def urls() return [] end |
#walk_statements(&block) ⇒ Object
Block will receive a Statement.
36 37 38 |
# File 'lib/fig/statement.rb', line 36 def walk_statements(&block) return end |