Sha256: 5794c9dc0dde9c83b229ed17f55169e28f6d3963b8dbaa4e099a72c2678619ff

Contents?: true

Size: 470 Bytes

Versions: 3

Compression:

Stored size: 470 Bytes

Contents

require 'jschematic/exceptions'

module Jschematic
  module Element
    attr_accessor :parent
    attr_writer   :id

    def required?
      false
    end

    def title
      nil
    end

    def id
      if @parent
        @parent.id + @id
      else
        @id
      end
    end

    def to_s
      self.class.to_s
    end

    private

    def fail_validation!(expected, actual)
      raise Jschematic::ValidationError.new(self, expected, actual)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jschematic-0.0.9 lib/jschematic/element.rb
jschematic-0.0.6 lib/jschematic/element.rb
jschematic-0.0.5 lib/jschematic/element.rb