Class: DynamicSprites::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/dynamic-sprites/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, path, options = {}) ⇒ Runner

Returns a new instance of Runner.



9
10
11
12
13
14
15
16
# File 'lib/dynamic-sprites/runner.rb', line 9

def initialize(command, path, options = {})
  @interface = Interface.new
  @command = command
  @path = Pathname.new(path) unless path.nil?
  @path ||= File.join(sass_directory, 'dynamic-sprites.sass') unless command.nil?
  @options = options
  @options[:output] ||= "#{@path}.png"
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



4
5
6
# File 'lib/dynamic-sprites/runner.rb', line 4

def command
  @command
end

#interfaceObject (readonly)

Returns the value of attribute interface.



7
8
9
# File 'lib/dynamic-sprites/runner.rb', line 7

def interface
  @interface
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/dynamic-sprites/runner.rb', line 6

def options
  @options
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/dynamic-sprites/runner.rb', line 5

def path
  @path
end

Instance Method Details

#run!Object

Runs dynamic-sprites command.



20
21
22
23
24
25
26
27
# File 'lib/dynamic-sprites/runner.rb', line 20

def run!
  case command
  when 'init'
    generate_mixin!
  when 'generate'
    generate_sprite!
  end
end