Sha256: b77442779e04029450a81af1f4b27ba7a84c207081f86147460bad0abbff9f24

Contents?: true

Size: 525 Bytes

Versions: 1

Compression:

Stored size: 525 Bytes

Contents

# lib/lutaml/model/attribute.rb
module Lutaml
  module Model
    class Attribute
      attr_reader :name, :type, :options

      def initialize(name, type, options = {})
        @name = name
        @type = type
        @options = options
      end

      def collection?
        options[:collection] || false
      end

      def default
        options[:default].is_a?(Proc) ? options[:default].call : options[:default]
      end

      def render_nil?
        options.fetch(:render_nil, false)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lutaml-model-0.1.0 lib/lutaml/model/attribute.rb