Class: Komonjo::Model::Emoji

Inherits:
Object
  • Object
show all
Defined in:
lib/komonjo/models/emoji.rb

Overview

slack emoji

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#alias=(value) ⇒ Object (writeonly)

Sets the attribute alias

Parameters:

  • value

    the value to set the attribute alias to.



6
7
8
# File 'lib/komonjo/models/emoji.rb', line 6

def alias=(value)
  @alias = value
end

#alias_nameObject

Returns the value of attribute alias_name.



5
6
7
# File 'lib/komonjo/models/emoji.rb', line 5

def alias_name
  @alias_name
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/komonjo/models/emoji.rb', line 5

def name
  @name
end

#urlObject

Returns the value of attribute url.



5
6
7
# File 'lib/komonjo/models/emoji.rb', line 5

def url
  @url
end

Class Method Details

.create(name, url) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/komonjo/models/emoji.rb', line 8

def self.create(name, url)
  new.tap do |e|
    e.name = name.to_s
    e.url = url.to_s
    url.match(/^alias:(?<alias_name>\S+)$/) do |m|
      e.alias = true
      e.alias_name = m[:alias_name]
    end
  end
end

Instance Method Details

#alias?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/komonjo/models/emoji.rb', line 19

def alias?
  @alias
end