Class: Marbu::Models::Code
- Inherits:
-
Object
- Object
- Marbu::Models::Code
- Defined in:
- lib/marbu/models/mrf/code.rb
Constant Summary collapse
- JS =
"JS"
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #default_params ⇒ Object
-
#initialize(ext_params = {}) ⇒ Code
constructor
A new instance of Code.
- #present? ⇒ Boolean
- #serializable_hash ⇒ Object
Constructor Details
#initialize(ext_params = {}) ⇒ Code
Returns a new instance of Code.
8 9 10 11 12 |
# File 'lib/marbu/models/mrf/code.rb', line 8 def initialize( ext_params = {} ) params = default_params.merge( ext_params.keep_if{|k,v|v} ) @text = params[:text] @type = params[:type] end |
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
4 5 6 |
# File 'lib/marbu/models/mrf/code.rb', line 4 def text @text end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/marbu/models/mrf/code.rb', line 4 def type @type end |
Instance Method Details
#default_params ⇒ Object
14 15 16 17 18 |
# File 'lib/marbu/models/mrf/code.rb', line 14 def default_params { :type => JS } end |
#present? ⇒ Boolean
27 28 29 |
# File 'lib/marbu/models/mrf/code.rb', line 27 def present? text.present? end |
#serializable_hash ⇒ Object
20 21 22 23 24 25 |
# File 'lib/marbu/models/mrf/code.rb', line 20 def serializable_hash { :text => text, :type => type }.delete_if{|k,v|v.blank?} end |