Class: Gort::Rule
- Inherits:
-
Object
- Object
- Gort::Rule
- Defined in:
- lib/gort/rule.rb
Overview
Generic rule. This represents an entry that looks like a valid rule but otherwise doesn’t have a more specialized implementation.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Symbol
readonly
The name of the rule.
-
#value ⇒ String
readonly
The value of the rule.
Formatting Methods collapse
-
#inspect ⇒ String
A human readable representation of the rule.
-
#pretty_print(pp) ⇒ void
Produces a pretty human readable representation of the rule.
Instance Method Summary collapse
-
#initialize(name, value) ⇒ Rule
constructor
A new instance of Rule.
Constructor Details
#initialize(name, value) ⇒ Rule
Returns a new instance of Rule.
10 11 12 13 |
# File 'lib/gort/rule.rb', line 10 def initialize(name, value) @name = name.downcase.to_sym @value = value end |
Instance Attribute Details
#name ⇒ Symbol (readonly)
The name of the rule.
17 18 19 |
# File 'lib/gort/rule.rb', line 17 def name @name end |
#value ⇒ String (readonly)
The value of the rule.
21 22 23 |
# File 'lib/gort/rule.rb', line 21 def value @value end |
Instance Method Details
#inspect ⇒ String
A human readable representation of the rule.
30 31 32 |
# File 'lib/gort/rule.rb', line 30 def inspect %(#<#{self.class.name}:#{object_id} "#{name}", "#{value}">) end |
#pretty_print(pp) ⇒ void
This method returns an undefined value.
Produces a pretty human readable representation of the rule.
41 42 43 |
# File 'lib/gort/rule.rb', line 41 def pretty_print(pp) pp.text("#{self.class.name}/#{object_id}< #{name.inspect}, #{value} >") end |