Sha256: 8eb28a2e74db47e9c9df7cea35a243af37a36bee21f17cb4e90277025b9c75b0
Contents?: true
Size: 542 Bytes
Versions: 2
Compression:
Stored size: 542 Bytes
Contents
module Hws::Connectors::Helper class << self def included(base) base.extend ClassMethods end end module ClassMethods def option(param, block = nil) [self, self.class].each do |_class| _class.class_eval do attr_accessor(param) next if block.nil? define_method(param) do instance_variable_set("@#{param}", block.call) if instance_variable_get("@#{param}").nil? instance_variable_get("@#{param}") end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hws-connectors-0.1.1 | lib/hws-connectors/helper.rb |
hws-connectors-0.1.0 | lib/hws-connectors/helper.rb |