Class: Senju::Change
- Inherits:
-
Object
- Object
- Senju::Change
- Defined in:
- lib/senju/change.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #filename ⇒ Object
-
#initialize(raw, type) ⇒ Change
constructor
A new instance of Change.
- #method_missing(method, *args, &block) ⇒ Object
- #patch ⇒ Object
Constructor Details
#initialize(raw, type) ⇒ Change
Returns a new instance of Change.
3 4 5 6 |
# File 'lib/senju/change.rb', line 3 def initialize(raw, type) @raw = raw @type = type end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/senju/change.rb', line 8 def method_missing(method, *args, &block) case type when "github" then @raw[method] when "gitlab" then @raw.send(method) end end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
2 3 4 |
# File 'lib/senju/change.rb', line 2 def raw @raw end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
2 3 4 |
# File 'lib/senju/change.rb', line 2 def type @type end |
Instance Method Details
#filename ⇒ Object
15 16 17 18 19 20 |
# File 'lib/senju/change.rb', line 15 def filename case type when "github" then super when "gitlab" then @raw["new_path"] end end |
#patch ⇒ Object
22 23 24 25 26 27 |
# File 'lib/senju/change.rb', line 22 def patch case type when "github" then super when "gitlab" then @raw["diff"] end end |