Sha256: 0645d51e21fadb60abf5123e0b69ed88fb1db8884004664732d4cc4d2f7de8fd

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

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.5.1.7 lib/jldrill/model/items/StringField.rb