class Mhc::PropertyValue::List

Constants

ITEM_SEPARATOR

Public Class Methods

new(item_class) click to toggle source
# File lib/mhc/property_value/list.rb, line 8
def initialize(item_class)
  @value = []
  @item_class = item_class
end

Public Instance Methods

each() { |value| ... } click to toggle source
# File lib/mhc/property_value/list.rb, line 13
def each
  @value.each do |value|
    yield value
  end
end
empty?() click to toggle source
# File lib/mhc/property_value/list.rb, line 23
def empty?
  @value.empty?
end
include?(o) click to toggle source
# File lib/mhc/property_value/list.rb, line 19
def include?(o)
  @value.include?(o)
end
parse(string) click to toggle source
# File lib/mhc/property_value/list.rb, line 27
def parse(string)
  string.strip.split(ITEM_SEPARATOR).each do |str|
    item = @item_class.parse(str)
    @value << item if item
  end
  return self
end
to_mhc_string() click to toggle source
# File lib/mhc/property_value/list.rb, line 35
def to_mhc_string
  @value.map{|item| item.to_mhc_string}.join(ITEM_SEPARATOR)
end
Also aliased as: to_s
to_s()
Alias for: to_mhc_string