Sha256: dccd0a42a45620d85c1d6184b6a3e7d1be794c0af9d791410d5af46ed1317889
Contents?: true
Size: 1.58 KB
Versions: 1
Compression:
Stored size: 1.58 KB
Contents
require 'vedeu/models/group' module Vedeu module DSL # DSL for adding interfaces to a group. # class Group include Vedeu::DSL # Specify a new group of interfaces with a simple DSL. # # The example below resembles 'vim' (the popular terminal-based text # editor): # # @example # Vedeu.group 'title_screen' do # add 'welcome_interface' # # ... # # Vedeu.group 'main_screen' do # add 'editor_interface' # add 'status_interface' # add 'command_interface' # # ... # # @note # Creating a group with the same name as an existing group overwrites # the existing group. # # @param name [String] The name of this group. # @param block [Proc] # @raise [InvalidSyntax] The required block was not given. # @return [Vedeu::Group] def self.group(name, &block) fail InvalidSyntax, 'block not given' unless block_given? Vedeu::Group.build({ name: name }, &block).store end # Returns an instance of DSL::Group. # # @param model [Group] # @param client [Object] # @return [Vedeu::DSL::Group] def initialize(model, client = nil) @model = model @client = client end # Add the named interface to this group. # # @param interface_name [String] # @return [void] def add(interface_name) model.add(interface_name) end private attr_reader :client, :model end # Group end # DSL end # Vedeu
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.4.4 | lib/vedeu/dsl/group.rb |