Class: LcpRuby::Generators::Entity::FieldDescriptor

Inherits:
Struct
  • Object
show all
Defined in:
lib/generators/lcp_ruby/entity/field_descriptor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#enum_valuesObject

Returns the value of attribute enum_values

Returns:

  • (Object)

    the current value of enum_values



6
7
8
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 6

def enum_values
  @enum_values
end

#modifiersObject

Returns the value of attribute modifiers

Returns:

  • (Object)

    the current value of modifiers



6
7
8
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 6

def modifiers
  @modifiers
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



6
7
8
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 6

def name
  @name
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



6
7
8
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 6

def options
  @options
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



6
7
8
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 6

def type
  @type
end

Instance Method Details

#association?Boolean

Returns:

  • (Boolean)


16
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 16

def association? = belongs_to? || has_many?

#belongs_to?Boolean

Returns:

  • (Boolean)


14
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 14

def belongs_to? = type == :belongs_to

#has_many?Boolean

Returns:

  • (Boolean)


15
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 15

def has_many?   = type == :has_many

#hidden?Boolean

Returns:

  • (Boolean)


19
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 19

def hidden?     = modifiers[:hidden] || false

#polymorphic?Boolean

Returns:

  • (Boolean)


17
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 17

def polymorphic? = modifiers[:polymorphic] || false

#required?Boolean

Returns:

  • (Boolean)


18
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 18

def required?   = modifiers[:required] || false

#target_modelObject



20
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 20

def target_model = options[:model] ? options[:model].to_sym : name.to_s.singularize.to_sym