class Yukata::Attribute

A single attribute that is attached to a model

@author Matthew A. Johnston

Attributes

type[R]

Public Class Methods

new(type=String, options={}) click to toggle source

@param type [Class] the class this attribute represents @param options [Hash] extra options that can be prescribed

# File lib/yukata/attribute.rb, line 10
def initialize(type=String, options={})
  @type = type

  if options[:default].is_a?(Proc)
    @default = options[:default]
  else
    @default = -> { options[:default] }
  end
end

Public Instance Methods

default() click to toggle source
# File lib/yukata/attribute.rb, line 20
def default
  @default.call
end