Class: MarkupAttributes::MarkupType

Inherits:
ActiveRecord::Type::String
  • Object
show all
Defined in:
lib/markup_attributes.rb

Overview

The type used by ActiveRecord’s attributes API

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.inspectObject



48
49
50
# File 'lib/markup_attributes.rb', line 48

def self.inspect
  "<MarkupType [#{markup_options}]>"
end

Instance Method Details

#cast(value) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/markup_attributes.rb', line 54

def cast(value)
  if value.is_a?(String) || value.is_a?(MarkupString)
    MarkupString.new(value).tap { |s| s.markup_options = self.markup_options }
  else
    super
  end
end