Class: HecksDomain::Generators::Spec

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/hecks/domain/generators/spec.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args, options) ⇒ Spec

Returns a new instance of Spec.



8
9
10
11
12
13
14
15
16
17
# File 'lib/hecks/domain/generators/spec.rb', line 8

def initialize(args, options)
  @domain = args[0]
  @aggregate = args[1]
  @root = args[2]

  @domain_name = @domain.name.to_s.underscore
  @aggregate_name = @aggregate.name.to_s.underscore
  @root_name = @root.name.to_s.underscore
  super
end

Instance Attribute Details

#aggregateObject (readonly)

Returns the value of attribute aggregate.



6
7
8
# File 'lib/hecks/domain/generators/spec.rb', line 6

def aggregate
  @aggregate
end

#aggregate_nameObject (readonly)

Returns the value of attribute aggregate_name.



6
7
8
# File 'lib/hecks/domain/generators/spec.rb', line 6

def aggregate_name
  @aggregate_name
end

#domainObject (readonly)

Returns the value of attribute domain.



6
7
8
# File 'lib/hecks/domain/generators/spec.rb', line 6

def domain
  @domain
end

#domain_nameObject (readonly)

Returns the value of attribute domain_name.



6
7
8
# File 'lib/hecks/domain/generators/spec.rb', line 6

def domain_name
  @domain_name
end

#rootObject (readonly)

Returns the value of attribute root.



6
7
8
# File 'lib/hecks/domain/generators/spec.rb', line 6

def root
  @root
end

#root_nameObject (readonly)

Returns the value of attribute root_name.



6
7
8
# File 'lib/hecks/domain/generators/spec.rb', line 6

def root_name
  @root_name
end

Class Method Details

.source_rootObject



21
22
23
# File 'lib/hecks/domain/generators/spec.rb', line 21

def self.source_root
  File.dirname(__FILE__) + '/../templates'
end

Instance Method Details

#write_directoryObject



25
26
27
# File 'lib/hecks/domain/generators/spec.rb', line 25

def write_directory
  directory('spec', skip: options[:skip_spec_generation])
end