Class: AliasLine

Inherits:
Object
  • Object
show all
Defined in:
lib/shell/alias_line.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line) ⇒ AliasLine

Returns a new instance of AliasLine.



4
5
6
# File 'lib/shell/alias_line.rb', line 4

def initialize(line)
  @line = line
end

Instance Attribute Details

#lineObject

Returns the value of attribute line.



2
3
4
# File 'lib/shell/alias_line.rb', line 2

def line
  @line
end

Instance Method Details

#alias_nameObject



8
9
10
# File 'lib/shell/alias_line.rb', line 8

def alias_name
  @line.split("=").first
end

#commandObject



16
17
18
19
# File 'lib/shell/alias_line.rb', line 16

def command
  c = @line.split("=")[1]
  c[1..(c.size-2)] if c
end

#valid?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/shell/alias_line.rb', line 12

def valid?
  @line.scan("=") != []
end