Sha256: 1db46af7e9fd58a78b66aa92ea396d2c81f7c8335e25528f9398aa1e24179b3e
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
class MappingContext < ErlMapper attr_accessor :sname, :parent def initialize(name, opts={}, &block) @__name = name @opts = opts instance_eval &block if block @sname ||= @__name end def string returning Array.new do |arr| %w(build_string start_commands final_commands).each {|meth| arr << self.send(meth).strip } end.join(" ").strip end def final_commands returning Array.new do |arr| arr << "-s init stop" if (opts.has_key?(:stop) && opts[:stop]) end.join(" ") end def build_string @build_string ||= "erl #{opts.map {|k,v| "-#{get_opt_name(k)} #{v}" if v && v.is_a?(String)}.join(" ")}" end def get_opt_name(k);methods.include?("erl_#{k}") ? self.send("erl_#{k}".to_sym) : "#{k}";end def start_commands;commands.map {|c| "-s #{c}"}.join(" ");end def commands;@commands ||= [];end def parent_string; parent ? parent.__name : nil; end def method_missing(m, *args, &block) command = Command.new(m, args).flatten commands.include?(command) ? super : commands.push(command) command end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
auser-skelerl-0.0.2 | lib/skelerl/erlpers/mappers/context.rb |
auser-skelerl-0.0.3 | lib/skelerl/erlpers/mappers/context.rb |
auser-skelerl-0.0.4 | lib/skelerl/erlpers/mappers/context.rb |