Class: Ritsu::ProjectGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/ritsu/project_generator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ ProjectGenerator

Returns a new instance of ProjectGenerator.



17
18
19
20
21
22
# File 'lib/ritsu/project_generator.rb', line 17

def initialize(name)
  if !ProjectGenerator.is_valid_generator_name?(name)
    raise ArgumentError.new("'#{name}' is not a valid project name (i.e., a C name)")
  end
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/ritsu/project_generator.rb', line 7

def name
  @name
end

Class Method Details

.generator_classesObject



9
10
11
# File 'lib/ritsu/project_generator.rb', line 9

def self.generator_classes
  @generator_classes ||= {}
end

.is_valid_generator_name?(name) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/ritsu/project_generator.rb', line 13

def self.is_valid_generator_name?(name)
  Ritsu::Utility::Strings::is_c_name?(name)
end

.validate_instance(instance) ⇒ Object



24
25
26
27
28
# File 'lib/ritsu/project_generator.rb', line 24

def self.validate_instance(instance)
  if instances.select { |x| x.name == instance.name }.length > 0
    raise ArgumentError.new("project generator with name '#{instance.name}' already exists")
  end
end

Instance Method Details

#generate(*args) ⇒ Object

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/ritsu/project_generator.rb', line 30

def generate(*args)
  raise NotImplementedError.new
end