Class: Pinspec::Factory

Inherits:
Data
  • Object
show all
Defined in:
lib/pinspec/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aliasesObject (readonly)

Returns the value of attribute aliases

Returns:

  • (Object)

    the current value of aliases



329
330
331
# File 'lib/pinspec/types.rb', line 329

def aliases
  @aliases
end

#attributesObject (readonly)

Returns the value of attribute attributes

Returns:

  • (Object)

    the current value of attributes



329
330
331
# File 'lib/pinspec/types.rb', line 329

def attributes
  @attributes
end

#callbacksObject (readonly)

Returns the value of attribute callbacks

Returns:

  • (Object)

    the current value of callbacks



329
330
331
# File 'lib/pinspec/types.rb', line 329

def callbacks
  @callbacks
end

#fileObject (readonly)

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



329
330
331
# File 'lib/pinspec/types.rb', line 329

def file
  @file
end

#hazardsObject (readonly)

Returns the value of attribute hazards

Returns:

  • (Object)

    the current value of hazards



329
330
331
# File 'lib/pinspec/types.rb', line 329

def hazards
  @hazards
end

#lineObject (readonly)

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



329
330
331
# File 'lib/pinspec/types.rb', line 329

def line
  @line
end

#modelObject (readonly)

Returns the value of attribute model

Returns:

  • (Object)

    the current value of model



329
330
331
# File 'lib/pinspec/types.rb', line 329

def model
  @model
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



329
330
331
# File 'lib/pinspec/types.rb', line 329

def name
  @name
end

#parentObject (readonly)

Returns the value of attribute parent

Returns:

  • (Object)

    the current value of parent



329
330
331
# File 'lib/pinspec/types.rb', line 329

def parent
  @parent
end

#traitsObject (readonly)

Returns the value of attribute traits

Returns:

  • (Object)

    the current value of traits



329
330
331
# File 'lib/pinspec/types.rb', line 329

def traits
  @traits
end

Instance Method Details

#associationsObject



340
341
342
# File 'lib/pinspec/types.rb', line 340

def associations
  attributes.select(&:association?)
end

#attribute(name) ⇒ Object



332
333
334
# File 'lib/pinspec/types.rb', line 332

def attribute(name)
  attributes.find { |a| a.name == name.to_sym }
end

#fires_callbacks?Boolean

Returns:

  • (Boolean)


348
349
350
# File 'lib/pinspec/types.rb', line 348

def fires_callbacks?
  !callbacks.empty?
end

#persists?Boolean

Returns:

  • (Boolean)


344
345
346
# File 'lib/pinspec/types.rb', line 344

def persists?
  !hazards.map(&:first).include?(:skip_create)
end

#trait(name) ⇒ Object



336
337
338
# File 'lib/pinspec/types.rb', line 336

def trait(name)
  traits.find { |t| t.name == name.to_sym }
end