Module: Libertree::Model::IsRemoteOrLocal

Included in:
Comment, Pool, Post
Defined in:
lib/libertree/model/is-remote-or-local.rb

Instance Method Summary collapse

Instance Method Details

#forestsObject



20
21
22
23
24
25
26
# File 'lib/libertree/model/is-remote-or-local.rb', line 20

def forests
  if self.remote?
    self.server.forests
  else
    Libertree::Model::Forest.all_local_is_member
  end
end

#local?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/libertree/model/is-remote-or-local.rb', line 12

def local?
  ! remote_id
end

#public_idObject



4
5
6
# File 'lib/libertree/model/is-remote-or-local.rb', line 4

def public_id
  self.remote_id || self.id
end

#remote?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/libertree/model/is-remote-or-local.rb', line 8

def remote?
  !! remote_id
end

#serverObject



16
17
18
# File 'lib/libertree/model/is-remote-or-local.rb', line 16

def server
  @server ||= self.member.server
end