Class: Graphiti::ResourceGenerator::ModelAction

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/graphiti/resource_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(class_name) ⇒ ModelAction

Returns a new instance of ModelAction.



50
51
52
# File 'lib/generators/graphiti/resource_generator.rb', line 50

def initialize(class_name)
  @class_name = class_name
end

Instance Attribute Details

#class_nameObject (readonly)

Returns the value of attribute class_name.



49
50
51
# File 'lib/generators/graphiti/resource_generator.rb', line 49

def class_name
  @class_name
end

Instance Method Details

#invoke!Object



54
55
56
57
58
# File 'lib/generators/graphiti/resource_generator.rb', line 54

def invoke!
  unless class_name.safe_constantize
    raise "You must define a #{class_name} model before generating the corresponding resource."
  end
end

#revoke!Object



60
61
62
# File 'lib/generators/graphiti/resource_generator.rb', line 60

def revoke!
  # Do nothing on destroy
end