Class: TheDude::Variable

Inherits:
Object
  • Object
show all
Defined in:
lib/the_dude/variable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, pattern) ⇒ TheDude::Variable

Creates an new variable instance based on the provided name and pattern.

Parameters:

  • name (Symbol)

    The name of the variable

  • pattern (Regexp)

    The pattern associated with the variable



16
17
18
19
# File 'lib/the_dude/variable.rb', line 16

def initialize name, pattern
  @name = name
  @pattern = pattern
end

Instance Attribute Details

#nameObject (readonly)

Symbol

The name of the variable



5
6
7
# File 'lib/the_dude/variable.rb', line 5

def name
  @name
end

#patternObject (readonly)

Regexp

The pattern associated with the variable



8
9
10
# File 'lib/the_dude/variable.rb', line 8

def pattern
  @pattern
end

Instance Method Details

#registerObject



21
22
23
# File 'lib/the_dude/variable.rb', line 21

def register
  TheDude.register_variable self
end