Class: Checkson::Context
- Inherits:
-
Object
- Object
- Checkson::Context
- Defined in:
- lib/checkson/context.rb
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #help(message = nil) ⇒ Object
-
#initialize(&block) ⇒ Context
constructor
A new instance of Context.
- #set(key, value) ⇒ Object
- #using(klass) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Context
Returns a new instance of Context.
7 8 9 10 11 12 |
# File 'lib/checkson/context.rb', line 7 def initialize(&block) @klass = nil @params = {} @help = [] instance_eval(&block) end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
5 6 7 |
# File 'lib/checkson/context.rb', line 5 def klass @klass end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
5 6 7 |
# File 'lib/checkson/context.rb', line 5 def params @params end |
Instance Method Details
#help(message = nil) ⇒ Object
22 23 24 25 |
# File 'lib/checkson/context.rb', line 22 def help( = nil) @help << if @help end |
#set(key, value) ⇒ Object
18 19 20 |
# File 'lib/checkson/context.rb', line 18 def set(key, value) @params[key.to_sym] = value end |
#using(klass) ⇒ Object
14 15 16 |
# File 'lib/checkson/context.rb', line 14 def using(klass) @klass = klass end |