class Trello::Schema::AttributeBuilder

Attributes

name[R]
options[R]

Public Class Methods

build(name, options = {}) click to toggle source
# File lib/trello/schema/attribute_builder.rb, line 5
def build(name, options = {})
  new(name, options).build
end
new(name, options) click to toggle source
# File lib/trello/schema/attribute_builder.rb, line 12
def initialize(name, options)
  @name = name
  @options = options
end

Public Instance Methods

build() click to toggle source
# File lib/trello/schema/attribute_builder.rb, line 17
def build
  attribute_class.new(
    name: name,
    options: options,
    serializer: serializer
  )
end

Private Instance Methods

attribute_class() click to toggle source
# File lib/trello/schema/attribute_builder.rb, line 27
def attribute_class
  class_name = options.delete(:class_name)
  return Schema::Attribute::Default unless class_name

  "Trello::Schema::Attribute::#{class_name}".constantize
end
serializer() click to toggle source
# File lib/trello/schema/attribute_builder.rb, line 34
def serializer
  serializer_class_name = options.delete(:serializer)
  return Schema::Serializer::Default unless serializer_class_name

  "Trello::Schema::Serializer::#{serializer_class_name}".constantize
end