Class: LcpRuby::Generators::Entity::FieldDescriptor
- Inherits:
-
Struct
- Object
- Struct
- LcpRuby::Generators::Entity::FieldDescriptor
- Defined in:
- lib/generators/lcp_ruby/entity/field_descriptor.rb
Instance Attribute Summary collapse
-
#enum_values ⇒ Object
Returns the value of attribute enum_values.
-
#modifiers ⇒ Object
Returns the value of attribute modifiers.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #association? ⇒ Boolean
- #belongs_to? ⇒ Boolean
- #has_many? ⇒ Boolean
- #hidden? ⇒ Boolean
- #polymorphic? ⇒ Boolean
- #required? ⇒ Boolean
- #target_model ⇒ Object
Instance Attribute Details
#enum_values ⇒ Object
Returns the value of attribute enum_values
6 7 8 |
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 6 def enum_values @enum_values end |
#modifiers ⇒ Object
Returns the value of attribute modifiers
6 7 8 |
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 6 def modifiers @modifiers end |
#name ⇒ Object
Returns the value of attribute name
6 7 8 |
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 6 def name @name end |
#options ⇒ Object
Returns the value of attribute options
6 7 8 |
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 6 def @options end |
#type ⇒ Object
Returns the value of attribute type
6 7 8 |
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 6 def type @type end |
Instance Method Details
#association? ⇒ Boolean
16 |
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 16 def association? = belongs_to? || has_many? |
#belongs_to? ⇒ Boolean
14 |
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 14 def belongs_to? = type == :belongs_to |
#has_many? ⇒ Boolean
15 |
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 15 def has_many? = type == :has_many |
#hidden? ⇒ Boolean
19 |
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 19 def hidden? = modifiers[:hidden] || false |
#polymorphic? ⇒ Boolean
17 |
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 17 def polymorphic? = modifiers[:polymorphic] || false |
#required? ⇒ Boolean
18 |
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 18 def required? = modifiers[:required] || false |
#target_model ⇒ Object
20 |
# File 'lib/generators/lcp_ruby/entity/field_descriptor.rb', line 20 def target_model = [:model] ? [:model].to_sym : name.to_s.singularize.to_sym |