class Croesus::Attribute
A single attribute that is attached to a model
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/croesus/attribute.rb, line 27 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/croesus/attribute.rb, line 37 def default @default.call end