Class: Henshin::Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/henshin/tags.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Tag

Returns a new instance of Tag.



6
7
8
9
# File 'lib/henshin/tags.rb', line 6

def initialize( name )
  @name = name
  @posts = []
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/henshin/tags.rb', line 4

def name
  @name
end

#postsObject

Returns the value of attribute posts.



4
5
6
# File 'lib/henshin/tags.rb', line 4

def posts
  @posts
end

Instance Method Details

#inspectObject



19
20
21
# File 'lib/henshin/tags.rb', line 19

def inspect
  "#<Tag:#{@name}>"
end

#to_hashObject



11
12
13
14
15
16
# File 'lib/henshin/tags.rb', line 11

def to_hash
  hash = {
    'name' => @name,
    'posts' => @posts.collect {|i| i.to_hash}
  }
end