Sha256: b16c48f721075c353e7b2df3e35d845cc0d72bfd7e837c2e7c16671e2e80c357

Contents?: true

Size: 408 Bytes

Versions: 17

Compression:

Stored size: 408 Bytes

Contents

class TicketTag

  def initialize(name, color)
    @name = name
    @color = color
  end

  attr_reader :name, :color

  def self.from_s(string)
    name, color = string.scan(/\[([^\]]+)\]\(([a-fA-F0-9]{6})\)/).flatten
    name = string unless name
    color = "e4e4e4" unless color
    new(name, color)
  end

  def to_s
    "[#{name}](#{color})"
  end

  def to_h
    {name: name, color: color}
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
houston-core-0.8.0.pre app/models/ticket_tag.rb
houston-core-0.7.0 app/models/ticket_tag.rb
houston-core-0.7.0.beta4 app/models/ticket_tag.rb
houston-core-0.7.0.beta3 app/models/ticket_tag.rb
houston-core-0.7.0.beta2 app/models/ticket_tag.rb
houston-core-0.7.0.beta app/models/ticket_tag.rb
houston-core-0.6.3 app/models/ticket_tag.rb
houston-core-0.6.2 app/models/ticket_tag.rb
houston-core-0.6.1 app/models/ticket_tag.rb
houston-core-0.6.0 app/models/ticket_tag.rb
houston-core-0.5.6 app/models/ticket_tag.rb
houston-core-0.5.5 app/models/ticket_tag.rb
houston-core-0.5.4 app/models/ticket_tag.rb
houston-core-0.5.3 app/models/ticket_tag.rb
houston-core-0.5.2 app/models/ticket_tag.rb
houston-core-0.5.1 app/models/ticket_tag.rb
houston-core-0.5.0 app/models/ticket_tag.rb