Class: Nicovideo::ThumbInfo

Inherits:
Hash
  • Object
show all
Defined in:
lib/nicovideo/thumbnail.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeThumbInfo

Returns a new instance of ThumbInfo.



55
56
57
# File 'lib/nicovideo/thumbnail.rb', line 55

def initialize
  @tags = {}
end

Instance Attribute Details

#tagsObject

Returns the value of attribute tags.



54
55
56
# File 'lib/nicovideo/thumbnail.rb', line 54

def tags
  @tags
end

Instance Method Details

#has_tag?(tag) ⇒ Boolean

Returns:

  • (Boolean)


59
60
61
62
# File 'lib/nicovideo/thumbnail.rb', line 59

def has_tag?(tag)
  @tag_hash ||= tag_flatten.inject({}) {|tag_hash, temp_tag| tag_hash[temp_tag] = temp_tag}
  @tag_hash.has_key? tag
end

#tag_flattenObject



64
65
66
# File 'lib/nicovideo/thumbnail.rb', line 64

def tag_flatten
  @tag_flatten ||= @tags.values.flatten
end