Class: RVC::Field
- Inherits:
-
Object
- Object
- RVC::Field
- Defined in:
- lib/rvc/field.rb
Constant Summary collapse
- ALL_FIELD_NAMES =
Set.new
Instance Method Summary collapse
- #block(&x) ⇒ Object
- #default(val = true) ⇒ Object
- #default? ⇒ Boolean
-
#initialize(name) ⇒ Field
constructor
A new instance of Field.
- #perfmetric_settings(x = nil) ⇒ Object
- #perfmetrics(x = nil) ⇒ Object
- #properties(x = nil) ⇒ Object
- #property(prop) ⇒ Object
- #summary(x = nil) ⇒ Object
Constructor Details
#initialize(name) ⇒ Field
Returns a new instance of Field.
126 127 128 129 130 131 132 133 134 135 |
# File 'lib/rvc/field.rb', line 126 def initialize name @name = name @summary = nil @properties = [] @perfmetrics = [] @perfmetric_settings = {} @block = nil @default = false ALL_FIELD_NAMES << name end |
Instance Method Details
#block(&x) ⇒ Object
153 154 155 |
# File 'lib/rvc/field.rb', line 153 def block &x x ? (@block = x) : @block end |
#default(val = true) ⇒ Object
157 158 159 |
# File 'lib/rvc/field.rb', line 157 def default val=true @default = val end |
#default? ⇒ Boolean
161 |
# File 'lib/rvc/field.rb', line 161 def default?; @default; end |
#perfmetric_settings(x = nil) ⇒ Object
149 150 151 |
# File 'lib/rvc/field.rb', line 149 def perfmetric_settings x=nil x ? (@perfmetric_settings.merge! x) : @perfmetric_settings end |
#perfmetrics(x = nil) ⇒ Object
145 146 147 |
# File 'lib/rvc/field.rb', line 145 def perfmetrics x=nil x ? (@perfmetrics.concat x) : @perfmetrics end |
#properties(x = nil) ⇒ Object
141 142 143 |
# File 'lib/rvc/field.rb', line 141 def properties x=nil x ? (@properties.concat x) : @properties end |
#property(prop) ⇒ Object
163 164 165 166 |
# File 'lib/rvc/field.rb', line 163 def property prop @properties = [prop] @block = lambda { |x| x } end |
#summary(x = nil) ⇒ Object
137 138 139 |
# File 'lib/rvc/field.rb', line 137 def summary x=nil x ? (@summary = x) : @summary end |