Skip to content

Latest commit

 

History

History
50 lines (37 loc) · 984 Bytes

compiler_activeresource.md

File metadata and controls

50 lines (37 loc) · 984 Bytes

ActiveResource

Tapioca::Dsl::Compilers::ActiveResource decorates RBI files for subclasses of ActiveResource::Base which declare schema fields.

For example, with the following ActiveResource::Base subclass:

class Post < ActiveResource::Base
  schema do
    integer 'id', 'month', 'year'
  end
end

this compiler will produce the RBI file post.rbi with the following content:

# post.rbi
# typed: true
class Post
  sig { returns(Integer) }
  def id; end

  sig { params(id: Integer).returns(Integer) }
  def id=(id); end

  sig { returns(T::Boolean) }
  def id?; end

  sig { returns(Integer) }
  def month; end

  sig { params(month: Integer).returns(Integer) }
  def month=(month); end

  sig { returns(T::Boolean) }
  def month?; end

  sig { returns(Integer) }
  def year; end

  sig { params(year: Integer).returns(Integer) }
  def year=(year); end

  sig { returns(T::Boolean) }
  def year?; end
end