Class: RightAws::ActiveSdb::ColumnSet
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ColumnSet.
1055
1056
1057
|
# File 'lib/sdb/active_sdb.rb', line 1055
def initialize
@columns = {}
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_sym, *args) ⇒ Object
1078
1079
1080
1081
1082
|
# File 'lib/sdb/active_sdb.rb', line 1078
def method_missing(method_sym, *args)
data_type = args.shift || :String
options = args.shift || {}
@columns[method_sym.to_s] = options.merge( :type => data_type )
end
|
Instance Attribute Details
Returns the value of attribute columns.
1054
1055
1056
|
# File 'lib/sdb/active_sdb.rb', line 1054
def columns
@columns
end
|
Instance Method Details
1059
1060
1061
|
# File 'lib/sdb/active_sdb.rb', line 1059
def all
@columns.keys
end
|
#column(col_name) ⇒ Object
Also known as:
include?
1063
1064
1065
|
# File 'lib/sdb/active_sdb.rb', line 1063
def column(col_name)
@columns[col_name.to_s]
end
|
#default(col_name) ⇒ Object
1072
1073
1074
1075
1076
|
# File 'lib/sdb/active_sdb.rb', line 1072
def default(col_name)
return nil unless include?(col_name)
default = column(col_name)[:default]
default.respond_to?(:call) ? default.call : default
end
|
#type_of(col_name) ⇒ Object
1068
1069
1070
|
# File 'lib/sdb/active_sdb.rb', line 1068
def type_of(col_name)
column(col_name) && column(col_name)[:type]
end
|