Class: JLDrill::StringField
- Defined in:
- lib/jldrill/model/items/StringField.rb
Constant Summary
Constants inherited from Field
Field::ESCAPED_COMMA_RE, Field::ESCAPED_SLASH_RE, Field::QUOTE_RE, Field::RETURN_RE, Field::SLASH_RE
Instance Method Summary collapse
- #assign(string) ⇒ Object
-
#contents ⇒ Object
Returns the actual contents of the field.
- #copy(field) ⇒ Object
- #eql?(string) ⇒ Boolean
- #fromString(string) ⇒ Object
-
#initialize(name, data) ⇒ StringField
constructor
A new instance of StringField.
-
#raw ⇒ Object
Returns a string of the field that has not been processed for output.
Methods inherited from Field
#assigned?, #output, #processInput, #processOutput, #to_s
Constructor Details
#initialize(name, data) ⇒ StringField
Returns a new instance of StringField.
9 10 11 12 |
# File 'lib/jldrill/model/items/StringField.rb', line 9 def initialize(name, data) super(name) @contents = data end |
Instance Method Details
#assign(string) ⇒ Object
41 42 43 |
# File 'lib/jldrill/model/items/StringField.rb', line 41 def assign(string) @contents = processInput(string) end |
#contents ⇒ Object
Returns the actual contents of the field
19 20 21 |
# File 'lib/jldrill/model/items/StringField.rb', line 19 def contents @contents end |
#copy(field) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/jldrill/model/items/StringField.rb', line 33 def copy(field) if field.assigned? @contents = field.contents else @contents = nil end end |
#eql?(string) ⇒ Boolean
45 46 47 48 49 50 51 |
# File 'lib/jldrill/model/items/StringField.rb', line 45 def eql?(string) if contents.nil? || contents.empty? !assigned? else @contents.eql?(string) end end |
#fromString(string) ⇒ Object
14 15 16 |
# File 'lib/jldrill/model/items/StringField.rb', line 14 def fromString(string) string end |
#raw ⇒ Object
Returns a string of the field that has not been processed for output
25 26 27 28 29 30 31 |
# File 'lib/jldrill/model/items/StringField.rb', line 25 def raw if assigned? @contents else "" end end |