Class: Gnip::Rule
- Inherits:
-
Object
- Object
- Gnip::Rule
- Defined in:
- lib/gnip-rules/rule.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#tag ⇒ Object
Returns the value of attribute tag.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(v, t = nil) ⇒ Rule
constructor
A new instance of Rule.
- #valid? ⇒ Boolean
Constructor Details
#initialize(v, t = nil) ⇒ Rule
Returns a new instance of Rule.
6 7 8 9 10 |
# File 'lib/gnip-rules/rule.rb', line 6 def initialize( v , t = nil ) @value = v @tag = t @errors = [] end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
4 5 6 |
# File 'lib/gnip-rules/rule.rb', line 4 def errors @errors end |
#tag ⇒ Object
Returns the value of attribute tag.
4 5 6 |
# File 'lib/gnip-rules/rule.rb', line 4 def tag @tag end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/gnip-rules/rule.rb', line 4 def value @value end |
Instance Method Details
#as_json(options = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/gnip-rules/rule.rb', line 12 def as_json(={}) o = {"value" => value} o.merge!( "tag" => tag ) unless tag.nil? return o end |
#valid? ⇒ Boolean
18 19 20 |
# File 'lib/gnip-rules/rule.rb', line 18 def valid? validate_length end |