Class: Cog::Generator::LanguageMethods::Scope

Inherits:
Object
  • Object
show all
Defined in:
lib/cog/generator/language_methods/scope.rb

Overview

Defines a program scope

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, name = nil) ⇒ Scope

Returns a new instance of Scope.

Parameters:

  • type (String)

    type of the scope

  • name (String) (defaults to: nil)

    name of the scope



16
17
18
19
# File 'lib/cog/generator/language_methods/scope.rb', line 16

def initialize(type, name=nil)
  @type = type.to_sym
  @name = name
end

Instance Attribute Details

#nameString? (readonly)

Returns name of the scope.

Returns:

  • (String, nil)

    name of the scope



12
13
14
# File 'lib/cog/generator/language_methods/scope.rb', line 12

def name
  @name
end

#typeSymbol (readonly)

Returns type of the scope. For example, :include_guard.

Returns:

  • (Symbol)

    type of the scope. For example, :include_guard



9
10
11
# File 'lib/cog/generator/language_methods/scope.rb', line 9

def type
  @type
end