Class: KKGit::GitOps::Status

Inherits:
Struct
  • Object
show all
Defined in:
lib/kk/git/git_ops.rb

Overview

仓库同步状态快照

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#aheadObject

Returns the value of attribute ahead

Returns:

  • (Object)

    the current value of ahead



12
13
14
# File 'lib/kk/git/git_ops.rb', line 12

def ahead
  @ahead
end

#behindObject

Returns the value of attribute behind

Returns:

  • (Object)

    the current value of behind



12
13
14
# File 'lib/kk/git/git_ops.rb', line 12

def behind
  @behind
end

#branchObject

Returns the value of attribute branch

Returns:

  • (Object)

    the current value of branch



12
13
14
# File 'lib/kk/git/git_ops.rb', line 12

def branch
  @branch
end

#cleanObject

Returns the value of attribute clean

Returns:

  • (Object)

    the current value of clean



12
13
14
# File 'lib/kk/git/git_ops.rb', line 12

def clean
  @clean
end

#detachedObject

Returns the value of attribute detached

Returns:

  • (Object)

    the current value of detached



12
13
14
# File 'lib/kk/git/git_ops.rb', line 12

def detached
  @detached
end

#remoteObject

Returns the value of attribute remote

Returns:

  • (Object)

    the current value of remote



12
13
14
# File 'lib/kk/git/git_ops.rb', line 12

def remote
  @remote
end

#upstream_configuredObject

Returns the value of attribute upstream_configured

Returns:

  • (Object)

    the current value of upstream_configured



12
13
14
# File 'lib/kk/git/git_ops.rb', line 12

def upstream_configured
  @upstream_configured
end

Instance Method Details

#behind_remote?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/kk/git/git_ops.rb', line 26

def behind_remote?
  behind.positive?
end

#needs_sync?Boolean

是否需要与远端同步(有未推送 commit 或落后远端)

Returns:

  • (Boolean)


18
19
20
# File 'lib/kk/git/git_ops.rb', line 18

def needs_sync?
  ahead.positive? || behind.positive?
end

#unpushed?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/kk/git/git_ops.rb', line 22

def unpushed?
  ahead.positive?
end