Class: Closx

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

Constant Summary collapse

VERSION =
"0.0.4"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(full_name) ⇒ Closx

Returns a new instance of Closx.



18
19
20
21
# File 'lib/closx.rb', line 18

def initialize full_name
  @full_name = full_name
  @name = full_name.gsub(' ', '').downcase
end

Instance Attribute Details

#full_nameObject (readonly)

Returns the value of attribute full_name.



16
17
18
# File 'lib/closx.rb', line 16

def full_name
  @full_name
end

#nameObject (readonly)

Returns the value of attribute name.



16
17
18
# File 'lib/closx.rb', line 16

def name
  @name
end

Class Method Details

.from_path(path) ⇒ Object



5
6
7
# File 'lib/closx.rb', line 5

def from_path path
  new strip(path)
end

Instance Method Details

#scriptObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/closx.rb', line 23

def script
  "#!/bin/sh\n#\n# Quick shortcut to \#{full_name}\n#\n# USAGE:\n\n# $ \#{name}\n# # => opens \#{full_name}\n#\n# $ \#{name} .\n# $ \#{name} /path/to/some_file\n# # => opens the specified directory/file in \#{full_name}\n\nopen -a \"\#{full_name}\" \"$1\"\n  EOS\nend\n"