Class: Csa::Ccm::Question
- Inherits:
-
Object
- Object
- Csa::Ccm::Question
- Defined in:
- lib/csa/ccm/question.rb
Constant Summary collapse
- ATTRIBS =
%i( id content )
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Question
constructor
A new instance of Question.
- #to_hash ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Question
Returns a new instance of Question.
11 12 13 14 15 16 17 |
# File 'lib/csa/ccm/question.rb', line 11 def initialize(={}) .each_pair do |k, v| self.send("#{k}=", v) end self end |
Instance Method Details
#to_hash ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/csa/ccm/question.rb', line 19 def to_hash ATTRIBS.inject({}) do |acc, attrib| value = self.send(attrib) unless value.nil? acc.merge(attrib.to_s => value) else acc end end end |