Class: ScriptLine
- Inherits:
-
Object
- Object
- ScriptLine
- Defined in:
- lib/shell/script_line.rb
Instance Attribute Summary collapse
-
#clean_words ⇒ Object
Returns the value of attribute clean_words.
-
#line ⇒ Object
Returns the value of attribute line.
-
#words ⇒ Object
Returns the value of attribute words.
Instance Method Summary collapse
- #command ⇒ Object
-
#initialize(l) ⇒ ScriptLine
constructor
A new instance of ScriptLine.
- #valid? ⇒ Boolean
Constructor Details
#initialize(l) ⇒ ScriptLine
Returns a new instance of ScriptLine.
4 5 6 7 8 |
# File 'lib/shell/script_line.rb', line 4 def initialize(l) @line = l.strip @words = l.split(/[ \t]+/) @clean_words = @words.map{|w| CommandWord.clean(w) } end |
Instance Attribute Details
#clean_words ⇒ Object
Returns the value of attribute clean_words.
2 3 4 |
# File 'lib/shell/script_line.rb', line 2 def clean_words @clean_words end |
#line ⇒ Object
Returns the value of attribute line.
2 3 4 |
# File 'lib/shell/script_line.rb', line 2 def line @line end |
#words ⇒ Object
Returns the value of attribute words.
2 3 4 |
# File 'lib/shell/script_line.rb', line 2 def words @words end |
Instance Method Details
#command ⇒ Object
10 11 12 |
# File 'lib/shell/script_line.rb', line 10 def command clean_words.first end |
#valid? ⇒ Boolean
14 15 16 |
# File 'lib/shell/script_line.rb', line 14 def valid? !(comment? || empty?) end |