Class: Riveter::Attributes::AttributeInfo

Inherits:
Struct
  • Object
show all
Defined in:
lib/riveter/attributes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#converterObject

Returns the value of attribute converter

Returns:

  • (Object)

    the current value of converter



310
311
312
# File 'lib/riveter/attributes.rb', line 310

def converter
  @converter
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



310
311
312
# File 'lib/riveter/attributes.rb', line 310

def name
  @name
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



310
311
312
# File 'lib/riveter/attributes.rb', line 310

def options
  @options
end

#targetObject

Returns the value of attribute target

Returns:

  • (Object)

    the current value of target



310
311
312
# File 'lib/riveter/attributes.rb', line 310

def target
  @target
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



310
311
312
# File 'lib/riveter/attributes.rb', line 310

def type
  @type
end

Instance Method Details

#defaultObject



315
316
317
# File 'lib/riveter/attributes.rb', line 315

def default
  @default ||= options[:default]
end

#default?Boolean

Returns:

  • (Boolean)


319
320
321
# File 'lib/riveter/attributes.rb', line 319

def default?
  !self.default.nil?
end

#evaluate_default(scope) ⇒ Object



323
324
325
# File 'lib/riveter/attributes.rb', line 323

def evaluate_default(scope)
  default? && default.respond_to?(:call) ? scope.instance_exec(&default) : default
end

#required?Boolean

Returns:

  • (Boolean)


311
312
313
# File 'lib/riveter/attributes.rb', line 311

def required?
  @required ||= (options[:required] == true)
end