Class: Clickwrap::SchemaRequirements::Feature

Inherits:
Data
  • Object
show all
Defined in:
lib/clickwrap/schema_requirements.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#becauseObject (readonly)

Returns the value of attribute because

Returns:

  • (Object)

    the current value of because



17
18
19
# File 'lib/clickwrap/schema_requirements.rb', line 17

def because
  @because
end

#flagObject (readonly)

Returns the value of attribute flag

Returns:

  • (Object)

    the current value of flag



17
18
19
# File 'lib/clickwrap/schema_requirements.rb', line 17

def flag
  @flag
end

#keyObject (readonly)

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



17
18
19
# File 'lib/clickwrap/schema_requirements.rb', line 17

def key
  @key
end

#tablesObject (readonly)

Returns the value of attribute tables

Returns:

  • (Object)

    the current value of tables



17
18
19
# File 'lib/clickwrap/schema_requirements.rb', line 17

def tables
  @tables
end

Instance Method Details

#explanationObject



20
21
22
23
24
25
# File 'lib/clickwrap/schema_requirements.rb', line 20

def explanation
  "#{because} That needs #{"the" if tables.length == 1}" \
    "#{tables.length == 1 ? " #{tables.first} table" : " tables #{tables.join(" and ")}"}, " \
    "which this database does not have. Add #{tables.length == 1 ? "it" : "them"}:\n\n  " \
    "#{generator_command}\n  bin/rails db:migrate"
end

#generator_commandObject



18
# File 'lib/clickwrap/schema_requirements.rb', line 18

def generator_command = "bin/rails generate clickwrap:install #{flag}"