Class: GHI::Issue

Inherits:
Object
  • Object
show all
Defined in:
lib/ghi/issue.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Issue

Returns a new instance of Issue.



5
6
7
8
9
10
11
12
13
14
# File 'lib/ghi/issue.rb', line 5

def initialize(options = {})
  @number     = options["number"]
  @title      = options["title"]
  @body       = options["body"]
  @votes      = options["votes"]
  @state      = options["state"]
  @user       = options["user"]
  @created_at = options["created_at"]
  @updated_at = options["updated_at"]
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



2
3
4
# File 'lib/ghi/issue.rb', line 2

def body
  @body
end

#created_atObject (readonly)

Returns the value of attribute created_at.



2
3
4
# File 'lib/ghi/issue.rb', line 2

def created_at
  @created_at
end

#numberObject (readonly)

Returns the value of attribute number.



2
3
4
# File 'lib/ghi/issue.rb', line 2

def number
  @number
end

#stateObject (readonly)

Returns the value of attribute state.



2
3
4
# File 'lib/ghi/issue.rb', line 2

def state
  @state
end

#titleObject (readonly)

Returns the value of attribute title.



2
3
4
# File 'lib/ghi/issue.rb', line 2

def title
  @title
end

#updated_atObject (readonly)

Returns the value of attribute updated_at.



2
3
4
# File 'lib/ghi/issue.rb', line 2

def updated_at
  @updated_at
end

#userObject (readonly)

Returns the value of attribute user.



2
3
4
# File 'lib/ghi/issue.rb', line 2

def user
  @user
end

#votesObject (readonly)

Returns the value of attribute votes.



2
3
4
# File 'lib/ghi/issue.rb', line 2

def votes
  @votes
end

Instance Method Details

#==(other_issue) ⇒ Object

- REFACTOR: This code is duplicated from cli.rb:gets_from_editor. +



19
20
21
22
23
24
25
26
27
28
# File 'lib/ghi/issue.rb', line 19

def ==(other_issue)
  case other_issue
  when Array
    other_title = other_issue.first.strip
    other_body  = other_issue[1..-1].join.sub(/\b\n\b/, " ").strip
    title == other_title && body == other_body
  else
    super other_issue
  end
end