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



321
322
323
# File 'lib/pinspec/types.rb', line 321

def aliases
  @aliases
end

#attributesObject (readonly)

Returns the value of attribute attributes

Returns:

  • (Object)

    the current value of attributes



321
322
323
# File 'lib/pinspec/types.rb', line 321

def attributes
  @attributes
end

#callbacksObject (readonly)

Returns the value of attribute callbacks

Returns:

  • (Object)

    the current value of callbacks



321
322
323
# File 'lib/pinspec/types.rb', line 321

def callbacks
  @callbacks
end

#fileObject (readonly)

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



321
322
323
# File 'lib/pinspec/types.rb', line 321

def file
  @file
end

#hazardsObject (readonly)

Returns the value of attribute hazards

Returns:

  • (Object)

    the current value of hazards



321
322
323
# File 'lib/pinspec/types.rb', line 321

def hazards
  @hazards
end

#lineObject (readonly)

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



321
322
323
# File 'lib/pinspec/types.rb', line 321

def line
  @line
end

#modelObject (readonly)

Returns the value of attribute model

Returns:

  • (Object)

    the current value of model



321
322
323
# File 'lib/pinspec/types.rb', line 321

def model
  @model
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



321
322
323
# File 'lib/pinspec/types.rb', line 321

def name
  @name
end

#parentObject (readonly)

Returns the value of attribute parent

Returns:

  • (Object)

    the current value of parent



321
322
323
# File 'lib/pinspec/types.rb', line 321

def parent
  @parent
end

#traitsObject (readonly)

Returns the value of attribute traits

Returns:

  • (Object)

    the current value of traits



321
322
323
# File 'lib/pinspec/types.rb', line 321

def traits
  @traits
end

Instance Method Details

#associationsObject



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

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

#attribute(name) ⇒ Object



324
325
326
# File 'lib/pinspec/types.rb', line 324

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

#fires_callbacks?Boolean

Returns:

  • (Boolean)


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

def fires_callbacks?
  !callbacks.empty?
end

#persists?Boolean

Returns:

  • (Boolean)


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

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

#trait(name) ⇒ Object



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

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