Class: CollectionJSON::QueryBuilder
- Inherits:
-
Object
- Object
- CollectionJSON::QueryBuilder
- Defined in:
- lib/collection-json/builder.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
- #add_data(name, value = '', prompt = '') ⇒ Object
-
#initialize(data) ⇒ QueryBuilder
constructor
A new instance of QueryBuilder.
Constructor Details
#initialize(data) ⇒ QueryBuilder
Returns a new instance of QueryBuilder.
82 83 84 |
# File 'lib/collection-json/builder.rb', line 82 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
80 81 82 |
# File 'lib/collection-json/builder.rb', line 80 def data @data end |
Instance Method Details
#add_data(name, value = '', prompt = '') ⇒ Object
86 87 88 89 90 91 |
# File 'lib/collection-json/builder.rb', line 86 def add_data(name, value = '', prompt = '') data << Data.from_hash({'name' => name}).tap do |data| data.merge!({'value' => value}) if value != '' data.merge!({'prompt' => prompt}) if prompt != '' end end |