Class: GitAuth::Message
- Inherits:
-
Object
- Object
- GitAuth::Message
- Defined in:
- lib/gitauth/message.rb
Constant Summary
- TEMPLATES =
YAML.load_file(BASE_DIR.join("resources", "messages.yml"))
Instance Attribute Summary (collapse)
-
- (Object) message
Returns the value of attribute message.
-
- (Object) name
Returns the value of attribute name.
-
- (Object) type
Returns the value of attribute type.
-
- (Object) variables
Returns the value of attribute variables.
Class Method Summary (collapse)
-
+ (Object) error(name = :unknown)
Handy accessor / generate methods for a given error code.
- + (Object) notice(name = :unknown)
- + (Object) warning(name = :unknown)
Instance Method Summary (collapse)
- - (Boolean) error?
-
- (Message) initialize(type, name, variables = {})
constructor
A new instance of Message.
- - (Boolean) success?
Constructor Details
- (Message) initialize(type, name, variables = {})
A new instance of Message
28 29 30 31 32 33 34 |
# File 'lib/gitauth/message.rb', line 28 def initialize(type, name, variables = {}) @type = type @name = name @variables = {} variables.each_pair { |k,v| @variables[k.to_s] = v } end |
Instance Attribute Details
- (Object) message
Returns the value of attribute message
26 27 28 |
# File 'lib/gitauth/message.rb', line 26 def @message end |
- (Object) name
Returns the value of attribute name
26 27 28 |
# File 'lib/gitauth/message.rb', line 26 def name @name end |
- (Object) type
Returns the value of attribute type
26 27 28 |
# File 'lib/gitauth/message.rb', line 26 def type @type end |
- (Object) variables
Returns the value of attribute variables
26 27 28 |
# File 'lib/gitauth/message.rb', line 26 def variables @variables end |
Class Method Details
+ (Object) error(name = :unknown)
Handy accessor / generate methods for a given error code.
48 49 50 |
# File 'lib/gitauth/message.rb', line 48 def error(name = :unknown) new(:error, name) end |
+ (Object) notice(name = :unknown)
52 53 54 |
# File 'lib/gitauth/message.rb', line 52 def notice(name = :unknown) new(:notice, name) end |
+ (Object) warning(name = :unknown)
56 57 58 |
# File 'lib/gitauth/message.rb', line 56 def warning(name = :unknown) new(:warning, name) end |
Instance Method Details
- (Boolean) error?
40 41 42 |
# File 'lib/gitauth/message.rb', line 40 def error? @type.to_sym == :error end |
- (Boolean) success?
36 37 38 |
# File 'lib/gitauth/message.rb', line 36 def success? @type.to_sym == :notice end |