Sha256: 1c3eba0917d424d328f1b0145c8c306f35dafc911b79fa9aec264c71053c0594

Contents?: true

Size: 542 Bytes

Versions: 2

Compression:

Stored size: 542 Bytes

Contents

class MemoryModel::Base::Fieldable::Field

  attr_reader :name, :options
  delegate :inspect, to: :to_sym

  def initialize(name, options={ })
    @name    = name.to_sym
    @options = options.reverse_merge!({ readonly: false, comparable: true })
  end

  def ==(other_object)
    self.to_sym == other_object.to_sym
  end

  def comparable?
    !!@options[:comparable]
  end

  def default
    @options[:default]
  end

  def readonly?
    !!@options[:readonly]
  end

  def to_sym
    @name.to_sym
  end

  def to_s
    @name.to_s
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
memory_model-0.0.2 lib/memory_model/base/fieldable/field.rb
memory_model-0.0.1 lib/memory_model/base/fieldable/field.rb