Class: BeautifulCss::Exec::Css

Inherits:
Object
  • Object
show all
Defined in:
lib/beautiful-css/exec.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Css

Returns a new instance of Css.



5
6
7
8
9
10
11
# File 'lib/beautiful-css/exec.rb', line 5

def initialize args
  if args.length != 1
    puts 'usage: beautifulcss [file]'
    exit 1
  end
  @args = args
end

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
# File 'lib/beautiful-css/exec.rb', line 14

def run
  file = File.open(@args.first, "rb")
  input = file.read
  file.close
  clean = BeautifulCss::Engine.new(input).render
  file = File.open(@args.first, "wb")
  file.puts clean
  file.close
end