Sha256: dae0f08a6584e203eb86941d959a8892a53df593716f56b0c4bd4d49423b2c19
Contents?: true
Size: 884 Bytes
Versions: 3
Compression:
Stored size: 884 Bytes
Contents
class AS attr_accessor :expr, :name, :type, :ref, :options def initialize expr, name=nil, type=nil, ref=nil, *option_flags case expr when AS self.expr = expr.expr self.name = expr.name self.type = expr.type self.ref = expr.ref self.options = expr.options end self.expr ||= expr self.name = name if name self.type = type if type self.ref = ref if ref self.options ||= { } option_flags.each{|option| self.options[option] = true } end def to_s clause = "%-30s \t" % [ref, expr].compact.join('::') if name clause << "AS #{name}" unless options[:skip_name] clause << ":#{type.typify}" unless ((!type) || options[:skip_type]) end clause end def self.[] *args self.new *args end # Useful for feeding back into TypedStruct def name_type [name, type] end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
mrflip-wukong-0.1.0 | lib/wukong/and_pig/as.rb |
wukong-0.1.4 | lib/wukong/and_pig/as.rb |
wukong-0.1.1 | lib/wukong/and_pig/as.rb |