class Timelime::Tags

Attributes

data[R]

Public Class Methods

new(raw = nil) click to toggle source
# File lib/timelime/tags.rb, line 7
def initialize raw = nil
  @data = []
  unless raw.nil?
    push raw
  end
end

Public Instance Methods

has?(tags) click to toggle source
# File lib/timelime/tags.rb, line 28
def has? tags
  (@data & tags.data) == tags.data
end
push(raw) click to toggle source
# File lib/timelime/tags.rb, line 14
def push raw

  raw.split.each do |tag|

    unless tag[0] == "@" and tag.length > 1
      throw :syntax
    end

    @data += [tag[1..-1]]

  end

end
to_s() click to toggle source
# File lib/timelime/tags.rb, line 32
def to_s
  buf = ""
  @data.each do |tag|
    unless buf.empty?
      buf += " "
    end
    buf += "@#{tag}"
  end
  buf
end