Sha256: fa1be1b391e589f0544e82eb3baa86e82dfa2cd8a40ca54153d9c9bb83f54bc2

Contents?: true

Size: 395 Bytes

Versions: 1

Compression:

Stored size: 395 Bytes

Contents

require 'rubiks/nodes/validated_node'

module ::Rubiks
  class AnnotatedNode < ::Rubiks::ValidatedNode
    value :name, String

    validates :name_present

    def name_present
      errors << "Name required on #{self.class.name.split('::').last}" if self.name.blank?
    end

    def parse_name(name_value)
      return if name_value.nil?

      self.name = name_value.to_s
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubiks-0.0.4 lib/rubiks/nodes/annotated_node.rb