首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > 其他 > valuable

valuable

  • 资源大小:675.00 B
  • 上传时间:2021-06-30
  • 下载次数:0次
  • 浏览次数:0次
  • 资源积分:1积分
  • 标      签: ruby Modeling baseclass

资 源 简 介

Introducing Valuable Valuable is a ruby base class that is essentially attr_accessor on steroids. Its aim is to provide Rails-like goodness where ActiveRecord isn"t an option. It intends to use a simple and intuitive interface, allowing you to get on with the logic specific to your application. Valuable provides the same dry declaration as attr_accessor, but includes default values, light weight type casting, a constructor that accepts an attributes hash, a class-level list of attributes, and an instance-level attributes hash. The type casting can also be used for parsing values. Example ``` class BaseballPlayer < Valuable hasvalue :atbats, :klass => Integer has_value :hits, :klass => Integer has_value :league, :default => "unknown" has_value :name has_value :jersey, :klass => Jersey, :default => "Unknown" has_collection :teammates def average hits/atbats.tof if hits && at_ba

文 件 列 表

valuable.rb
VIP VIP
0.169306s