lib/shirinji/bean.rb in shirinji-0.0.2 vs lib/shirinji/bean.rb in shirinji-0.0.3
- old
+ new
@@ -1,18 +1,21 @@
# frozen_string_literal: true
module Shirinji
class Bean
- attr_reader :name, :class_name, :value, :access, :attributes
+ attr_reader :name, :class_name, :value, :access, :attributes, :construct
- def initialize(name, class_name: nil, value: nil, access:, &block)
+ def initialize(
+ name, class_name: nil, value: nil, access:, construct: true, &block
+ )
check_params!(class_name, value)
@name = name
@class_name = class_name
@value = value
@access = access
@attributes = {}
+ @construct = construct
instance_eval(&block) if block
end
def attr(name, ref:)