Class: Concrete

Inherits:
Tool
  • Object
show all
Defined in:
lib/shed/concrete.rb

Overview

Takes an ActionScript 3 Interface file and generates a concrete implementation from it.

Constant Summary

Constants inherited from Tool

Tool::INVALID_OPTS

Instance Method Summary collapse

Methods inherited from Tool

#add_sigint_handler, #generated_at, #log, #puts, #to_disk

Constructor Details

#initialize(opt, out = STDOUT) ⇒ Concrete

Returns a new instance of Concrete.



8
9
10
11
12
13
14
15
16
17
# File 'lib/shed/concrete.rb', line 8

def initialize(opt,out=STDOUT)
  super(opt,out)

  @interface = opt[:interface]

  do_exit unless valid_opts

  create_mixer(opt[:type])
  generate(File.new(@interface).read)
end

Instance Method Details

#generate(file) ⇒ Object

Parse the Interface and outputs the concrete document.



29
30
31
32
# File 'lib/shed/concrete.rb', line 29

def generate(file)
  @parser = Interface.new(file) rescue do_exit
  output
end

#valid_optsObject

Valid if an Interface has been supplied in the options.



22
23
24
# File 'lib/shed/concrete.rb', line 22

def valid_opts
  File.exist?(@interface) rescue false
end