Class: GoogleDataSource::DataSource::Column
- Inherits:
-
Object
- Object
- GoogleDataSource::DataSource::Column
- Defined in:
- lib/google_data_source/column.rb
Constant Summary collapse
- COLTYPES =
%w(boolean number string date datetime timeofday)
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#label ⇒ Object
Returns the value of attribute label.
-
#pattern ⇒ Object
Returns the value of attribute pattern.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(params) ⇒ Column
constructor
COLKEYS = [:type, :id, :label, :pattern].
- #to_h ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(params) ⇒ Column
COLKEYS = [:type, :id, :label, :pattern]
9 10 11 12 13 14 |
# File 'lib/google_data_source/column.rb', line 9 def initialize(params) @type = (params[:type] || :string).to_s @id = params[:id].to_sym @label = params[:label] @pattern = params[:pattern] end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/google_data_source/column.rb', line 4 def id @id end |
#label ⇒ Object
Returns the value of attribute label.
4 5 6 |
# File 'lib/google_data_source/column.rb', line 4 def label @label end |
#pattern ⇒ Object
Returns the value of attribute pattern.
4 5 6 |
# File 'lib/google_data_source/column.rb', line 4 def pattern @pattern end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/google_data_source/column.rb', line 4 def type @type end |
Instance Method Details
#to_h ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/google_data_source/column.rb', line 20 def to_h { :id => id, :type => type, :label => label, :pattern => pattern } end |
#valid? ⇒ Boolean
16 17 18 |
# File 'lib/google_data_source/column.rb', line 16 def valid? COLTYPES.include?(type) end |