Class: User

Inherits:
Object
  • Object
show all
Includes:
Templator
Defined in:
lib/generators/feature/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Templator

#render

Constructor Details

#initialize(generator, name) ⇒ User

Returns a new instance of User.



7
8
9
10
# File 'lib/generators/feature/user.rb', line 7

def initialize(generator, name)
  @generator = generator
  @name = name
end

Instance Attribute Details

#generatorObject (readonly)

Returns the value of attribute generator.



5
6
7
# File 'lib/generators/feature/user.rb', line 5

def generator
  @generator
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/generators/feature/user.rb', line 5

def name
  @name
end

Instance Method Details

#background_steps(action = nil) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/generators/feature/user.rb', line 12

def background_steps(action = nil)
  if action == :new
    render File.join('features', 'users', "background_steps.feature")
  else
    render File.join('features', 'users', "background_steps_with_models.feature")
  end
end

#set?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/generators/feature/user.rb', line 20

def set?
  !@name.nil?
end