Class: Shale::Attribute

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/shale/attribute.rb,
lib/shale/builder/nested_validations.rb

Overview

rubocop:disable Style/Documentation

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aliasesObject

Contains the documentation comment for the shale attribute in a Ruby String. : Array?



24
25
26
# File 'lib/shale/attribute.rb', line 24

def aliases
  @aliases
end

#docObject

Contains the documentation comment for the shale attribute in a Ruby String. : String?



19
20
21
# File 'lib/shale/attribute.rb', line 19

def doc
  @doc
end

#return_typeObject

: untyped



14
15
16
# File 'lib/shale/attribute.rb', line 14

def return_type
  @return_type
end

#setter_typeObject

: untyped



11
12
13
# File 'lib/shale/attribute.rb', line 11

def setter_type
  @setter_type
end

Instance Method Details

#all_namesObject

: -> Array



27
28
29
30
31
32
33
# File 'lib/shale/attribute.rb', line 27

def all_names
  names = [name]
  aliases = self.aliases
  return names unless aliases

  names + aliases
end

#builder?Boolean

Returns ‘true` if the attribute is handled by a shale builder.

: -> bool

Returns:

  • (Boolean)


45
46
47
# File 'lib/shale/attribute.rb', line 45

def builder?
  type.is_a?(Class) && type < Shale::Builder
end

#mapper?Boolean

Returns ‘true` if the attribute is handled by a shale mapper.

: -> bool

Returns:

  • (Boolean)


38
39
40
# File 'lib/shale/attribute.rb', line 38

def mapper?
  type.is_a?(Class) && type < Shale::Mapper
end

#validatable?Boolean

: -> bool

Returns:

  • (Boolean)


97
98
99
# File 'lib/shale/builder/nested_validations.rb', line 97

def validatable?
  Boolean(type.is_a?(Class) && type < ::ActiveModel::Validations)
end