Sha256: bfcbd79035bf55997db5ca6b306187c93ec414c6da5e324af7cb34e936a2b7e0

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

# encoding: utf-8
require "jldrill/model/items/Field"

# Represents a string type Field in a Vocabulary

module JLDrill
    class StringField < Field

        def initialize(name, data)
            super(name)
            @contents = data
        end
        
        def fromString(string)
            string
        end
            
        # Returns the actual contents of the field
        def contents
            @contents
        end

        # Returns a string of the field that has not been processed
        # for output
        def raw
            if assigned?
                @contents
            else
                ""
            end
        end

        def copy(field)
            if field.assigned?
                @contents = field.contents
            else
                @contents = nil
            end
        end

        def assign(string)
            @contents = processInput(string)
        end

        def eql?(string)
            if contents.nil? || contents.empty?
                !assigned?
            else
                @contents.eql?(string)
            end
        end

    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jldrill-0.6.0.1 lib/jldrill/model/items/StringField.rb