Class: Compile
- Inherits:
-
Object
- Object
- Compile
- Defined in:
- lib/aml/Compile.rb
Instance Method Summary collapse
-
#initialize(argument) ⇒ Compile
constructor
A new instance of Compile.
- #log ⇒ Object
- #post_process ⇒ Object
- #process ⇒ Object
- #structure ⇒ Object
Constructor Details
#initialize(argument) ⇒ Compile
Returns a new instance of Compile.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/aml/Compile.rb', line 3 def initialize(argument) @argument = argument file = @argument.get('build') @prepare = Prepare.new(file) @inline = [ {:type=> :attribute, :regex=> /@\(\:(?<name>[\w|\-]+)\)/}, {:type=> :method, :regex=> /::((?<bundle>[\w|\-]+)\.)?(?<name>[\w|\-]+)(\{(?<attribute>.+)\})?/}, {:type=> :variable, :regex=> /\@\(((?<bundle>[\w|\-]+)\.)?(?<name>[\w|\-]+)\)/} ] @prepare.cluster.variables['false'] = {} if @prepare.cluster.variables.include?('false') == false local = [ {:name=> 'file-created', :value=> Time.new.strftime('%Y-%m-%d %H:%M:%S')}, {:name=> 'file-name', :value=> File.basename(file)}, {:name=> 'file-path', :value=> File.(file)} ].each do |variable| @prepare.cluster.variables['false'][variable[:name].to_s] = [{:number=>0, :value=>variable[:value].to_s}] end @log = [] @prepare.log.each do |log| if log[:type] == "mixin" @log << log if log[:bundle] != false else @log << log end end if @log.count == 0 process @prepare.cluster.post_process end end |
Instance Method Details
#log ⇒ Object
38 39 40 |
# File 'lib/aml/Compile.rb', line 38 def log @log end |
#post_process ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/aml/Compile.rb', line 54 def post_process @prepare.cluster.definition.each do |definition| definition.self[:hash].each_with_index do |line, index| process_variable_and_method(line, index, definition, true) end end end |
#process ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/aml/Compile.rb', line 44 def process @prepare.cluster.definition.each do |definition| definition.self[:hash].each_with_index do |line, index| process_variable_and_method(line, index, definition) process_mixin(line, index, definition) process_partial(line, index, definition) end end process if @prepare.cluster.definition.select{|k|k.self[:type] == "base"}.first.self[:hash].select{|k|k[:type] == :mixin or k[:type] == :partial}.count > 0 end |
#structure ⇒ Object
41 42 43 |
# File 'lib/aml/Compile.rb', line 41 def structure @prepare.cluster.definition.select{|k|k.self[:type] == "base"}.first.self[:hash] end |