Class: Aliyun::Odps::Struct::Base
- Inherits:
-
Object
- Object
- Aliyun::Odps::Struct::Base
- Defined in:
- lib/aliyun/odps/struct.rb
Direct Known Subclasses
DownloadSession, Function, Instance, InstanceTask, Project, Resource, Table, TableColumn, TablePartition, TableSchema, TaskResult, UploadBlock, UploadSession
Class Attribute Summary collapse
-
.required_attrs ⇒ Object
readonly
Returns the value of attribute required_attrs.
Class Method Summary collapse
Instance Method Summary collapse
- #client ⇒ Object
-
#initialize(attributes = {}) ⇒ Base
constructor
A new instance of Base.
- #update_attrs(attrs) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Base
Returns a new instance of Base.
5 6 7 8 9 10 11 12 |
# File 'lib/aliyun/odps/struct.rb', line 5 def initialize(attributes = {}) attributes.each do |key, value| m = "#{Utils.underscore(key)}=".to_sym send(m, value) if self.respond_to?(m) end validate_required end |
Class Attribute Details
.required_attrs ⇒ Object (readonly)
Returns the value of attribute required_attrs.
35 36 37 |
# File 'lib/aliyun/odps/struct.rb', line 35 def required_attrs @required_attrs end |
Class Method Details
.property(attr, type, options = {}) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/aliyun/odps/struct.rb', line 48 def property(attr, type, = {}) @required_attrs ||= [] @required_attrs << attr.to_s if [:required] define_reader_method(attr) define_writer_method(attr, type, ) end |
Instance Method Details
#client ⇒ Object
30 31 32 |
# File 'lib/aliyun/odps/struct.rb', line 30 def client project.client end |
#update_attrs(attrs) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/aliyun/odps/struct.rb', line 23 def update_attrs(attrs) attrs.each do |k, v| send("#{Utils.underscore(k)}=", v) end self end |