Class: CIQuantum::Adater::Unfuddle::Changeset
- Inherits:
-
Object
- Object
- CIQuantum::Adater::Unfuddle::Changeset
- Defined in:
- lib/ciquantum/adapter/unfuddle/changeset.rb
Constant Summary collapse
- FIELDS =
%w(repository_id revision message committer_name committer_date).freeze
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#commit ⇒ Object
readonly
Returns the value of attribute commit.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Instance Method Summary collapse
-
#initialize(xml) ⇒ Changeset
constructor
A new instance of Changeset.
Constructor Details
#initialize(xml) ⇒ Changeset
Returns a new instance of Changeset.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ciquantum/adapter/unfuddle/changeset.rb', line 18 def initialize(xml) xml = xml.to_s.strip raise ChangesetError, 'Changeset XML required!' if xml.empty? begin @data = Hash.from_xml(xml) rescue REXML::ParseException raise ChangesetError, 'Invalid XML data!' end raise ChangesetError, 'Invalid changeset!' unless @data.key?('changeset') @xml = xml @data = @data['changeset'] unless (FIELDS & @data.keys).size == FIELDS.size raise ChangesetError, 'Invalid changeset!' end @commit = @data['revision'] @author = @data['committer_name'] @message = @data['message'] @date = @data['committer_date'] @repo = @data['repository_id'] end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
11 12 13 |
# File 'lib/ciquantum/adapter/unfuddle/changeset.rb', line 11 def @author end |
#commit ⇒ Object (readonly)
Returns the value of attribute commit.
14 15 16 |
# File 'lib/ciquantum/adapter/unfuddle/changeset.rb', line 14 def commit @commit end |
#date ⇒ Object (readonly)
Returns the value of attribute date.
13 14 15 |
# File 'lib/ciquantum/adapter/unfuddle/changeset.rb', line 13 def date @date end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
12 13 14 |
# File 'lib/ciquantum/adapter/unfuddle/changeset.rb', line 12 def @message end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
15 16 17 |
# File 'lib/ciquantum/adapter/unfuddle/changeset.rb', line 15 def repo @repo end |
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
16 17 18 |
# File 'lib/ciquantum/adapter/unfuddle/changeset.rb', line 16 def xml @xml end |