Module: Sirius::Attribute

Included in:
Post
Defined in:
lib/sirius/attribute.rb

Overview

Macro

Generate attributes with default value. And convert attribute to need type. Because json return some values as String but it must be Integer. :method: int as attr_int :method: str as attr_str

Get Array attributes and default value

Example

class A
  extend Attribute

  int [:a, :b, :c] 
  int [:d], 10
  str [:k], "foo"   
 end

 a = A.new

 a.a # => 0 
 a.a = "10" 

 a.a # => 10
 a.a.class # => Fixnum

 a.k # => "foo"
 a.k = "bar"
 a.k # => "bar"