Class: Lifestream::Branch

Inherits:
Object
  • Object
show all
Defined in:
lib/lifestream/branch.rb

Defined Under Namespace

Classes: InvalidBranch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(channel, published_at, title, body = nil) ⇒ Branch

Returns a new instance of Branch.



6
7
8
9
10
11
# File 'lib/lifestream/branch.rb', line 6

def initialize channel, published_at, title, body = nil
  @channel, @published_at, @title, @body = channel, published_at, title, body
  unless @channel.kind_of?(Lifestream::Channel)
    raise Lifestream::Branch::InvalidBranch.new('@channel is not a kind if Lifestream::Channel') 
  end
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



4
5
6
# File 'lib/lifestream/branch.rb', line 4

def body
  @body
end

#channelObject

Returns the value of attribute channel.



4
5
6
# File 'lib/lifestream/branch.rb', line 4

def channel
  @channel
end

#published_atObject

Returns the value of attribute published_at.



4
5
6
# File 'lib/lifestream/branch.rb', line 4

def published_at
  @published_at
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/lifestream/branch.rb', line 4

def title
  @title
end

Instance Method Details

#inspectObject



13
14
15
# File 'lib/lifestream/branch.rb', line 13

def inspect
  "#<Lifestream::Branch @published_at=#{@published_at} @title=#{@title} @body=#{@body} @channel=#{!!@channel}>"
end