king_placeholder:解析字符串中的占位符

时间:2021-06-09 13:24:47
【文件属性】:
文件名称:king_placeholder:解析字符串中的占位符
文件大小:12KB
文件格式:ZIP
更新时间:2021-06-09 13:24:47
Ruby KingPlaceholder 这个 gem 对用户在电子邮件、文本和导出模板中提供的字符串进行简单的 [占位符] 替换。 占位符在每个类中声明,然后任何包含[占位符] 的字符串都可以在模型范围内解析。 解析是由一个简单的状态机完成的,使用正则表达式进行占位符检测。 用法 使用“has_placeholders”定义类中的可用方法 class User include KingPlaceholder has_many :comments has_one :company has_placeholders :name , :email end class Comment include KingPlaceholder has_placeholders :text end 在方括号中使用占位符名称: @user = User.new( name: "Scho
【文件预览】:
king_placeholder-master
----.gitignore(168B)
----placeholder_state.dia(2KB)
----Gemfile(37B)
----king_placeholder.gemspec(1009B)
----LICENSE(1KB)
----spec()
--------king_placeholder_spec.rb(6KB)
--------spec_helper.rb(391B)
----README.rdoc(2KB)
----.travis.yml(51B)
----lib()
--------king_placeholder.rb(5KB)
--------king_placeholder()
----Rakefile(182B)

网友评论