class Cog::Seed::Var

Template for a variable in a target language

Attributes

desc[R]
name[R]

@return [String] name of the variable

scope[R]
type[R]

Public Class Methods

new(type, name, opt={}) click to toggle source

@api developer

# File lib/cog/seed/var.rb, line 19
def initialize(type, name, opt={})
  @type = type
  @name = name.to_s.to_ident
  @desc = opt[:desc]
  @scope = opt[:scope]
end

Public Instance Methods

<=>(other) click to toggle source

Sort by name

# File lib/cog/seed/var.rb, line 37
def <=>(other)
  @name <=> other
end
qualify?() click to toggle source
# File lib/cog/seed/var.rb, line 26
def qualify?
  @qualify
end
stamp_decl(qualify = false) click to toggle source
# File lib/cog/seed/var.rb, line 30
def stamp_decl(qualify = false)
  l = Cog.active_language
  @qualify = qualify && @scope
  stamp "cog/#{l.key}/var_decl.#{l.seed_extension}"
end